我有一个 SQL 代码如下:
public void UpdateDatabase(String strParam1, int row)
{
System.Data.OracleClient.OracleConnection conn = new System.Data.OracleClient.OracleConnection();
conn.ConnectionString = "Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.144)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl)));UID=mwm;PWD=mwm";
conn.Open();
OracleCommand command = conn.CreateCommand();
command.CommandText = "Select id from Task";
OracleParameter taskId = new OracleParameter();
taskId.DbType = DbType.Int32;
taskId.Value = taskId;
taskId.ParameterName = "taskId";
command.Parameters.Add(taskId);
command.ExecuteNonQuery();
command.Dispose();
}
}
达到 ExecuteNonQuery 时,我收到错误“无法将参数值从 OracleParameter 转换为 Int32”这里有什么问题?我用谷歌搜索但无法得出结论。