I am trying to write some methods which should be DB independent, so that the same code can be used irrespective of DB (Oracle, SQL server)
I am using IDbConnection and IDbCommand interfaces for this.. While calling the procedure it gives error saying Illegal Variable name/number error. Though I am able to call the inline query directly(Directly specifying the query as the command Text) Here is the sample call..
using (IDbConnection connection = this._providerFactory.CreateConnection())
{
// create the command object using the conneciton object
IDbCommand command = connection.CreateCommand();
//start
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "GetResponse";
IDbDataParameter menuParam = this._providerFactory.CreateParameter();
menuParam.DbType = DbType.String;
menuParam.Direction = ParameterDirection.Input;
menuParam.ParameterName = "@V_USER_ID";
command.Parameters.Add(menuParam);
IDbDataParameter menuParam2 = this._providerFactory.CreateParameter();
menuParam2.Size = 20;
menuParam2.DbType = DbType.String;
menuParam2.Size = 20;
menuParam2.Direction = ParameterDirection.Output;
menuParam2.ParameterName = "@V_ROLE_ID";
menuParam2.Value = DBNull.Value;
command.Parameters.Add(menuParam2);
//end
command.ExecuteNonQuery();
}