Home  >  Article  >  Backend Development  >  SqlCommand.DeriveParameters failed

SqlCommand.DeriveParameters failed

黄舟
黄舟Original
2017-02-16 10:45:331687browse

The error message is as follows:


SqlCommand.DeriveParameters failed because the SqlCommand.CommandText property value is an invalid multipart name 
"SELECT * from tableA", the current limit of "4" is insufficient。


Error reason:

When using Enterprise Library for database operations, if you use SQL statements directly instead of stored procedures, you must use the overload method:
_db.ExecuteDataSet(CommandType type, String sql)

instead of:

public virtual DataSet ExecuteDataSet(
	string storedProcedureName,
	params Object[] parameterValues
)


Detailed introduction: Click to open the link


or get the Db through sql Command, then execute:


ExecuteDataSet overload method is as follows:

Database.ExecuteDataSet Method (DbCommand)

public virtual DataSet ExecuteDataSet(
	DbCommand command
)


Database.ExecuteDataSet Method ( CommandType, String)


public virtual DataSet ExecuteDataSet(
	CommandType commandType,
	string commandText
)


Database.ExecuteDataSet Method (DbCommand, DbTransaction)


public virtual DataSet ExecuteDataSet(
	DbCommand command,
	DbTransaction transaction
)


Database.Execute DataSet Method (String, Object[])


public virtual DataSet ExecuteDataSet(
	string storedProcedureName,
	params Object[] parameterValues
)

Database.ExecuteDataSet Method (DbTransaction, CommandType, String)


public virtual DataSet ExecuteDataSet(
	DbTransaction transaction,
	CommandType commandType,
	string commandText
)


Database.ExecuteDataSet Method (DbTransaction, String, Object[])


public virtual DataSet ExecuteDataSet(
	DbTransaction transaction,
	string storedProcedureName,
	params Object[] parameterValues
)


The above is the content of SqlCommand.DeriveParameters failed. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!




Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn