none
Enterprise Lib 3.1 -- System.Data.Common.DbCommand' does not contain a definition for 'AddOutParameter' RRS feed

  • Question

  • private void AppendParameters(List<SqlParameter> parameters, DbCommand cmd)
            {
                if (parameters != null)
                {
                    foreach (DbParameter param in parameters)
                    {
                        if (param.Direction == ParameterDirection.Output)
                        {                      
                            cmd.AddOutParameter(param.ParameterName, param.DbType, param.Size);
                        }
                        else
                        {
                            cmd.AddParameter(param.ParameterName, param.DbType, param.Direction, param.SourceColumn, param.SourceVersion, param.Value);
                        }
                    }
                }
            }

    While compiling, above code gives error System.Data.Common.DbCommand' does not contain a definition for 'AddOutParameter'. and  System.Data.Common.DbCommand' does not contain a definition for 'AddParameter' I am using Enterprise Lib 3.1

    Thursday, April 3, 2008 6:37 AM

All replies

  • Friends,

    Need your help!

    Here is my code:

     

    =======================================

    DbCommand DbParameter parameters = (DbParameter)cmd.CreateParameter();

    parameters.ParameterName = "@LoginName";

    parameters.Value = logOn;

    cmd.Parameters.Add(parameters);

     

    cmd = dbUtil.DB.GetStoredProcCommand(DBCommands.PR_GET_ACCOUNT);

    cmd.CommandType = CommandType.StoredProcedure;

    ======================================

     

    The problem is that this works fine with SQL server but not with sybase, it asks for missing token in the parameter. I tried using above way to add parameter but I am not getting AddParameter in cmd, only add is there.

     

    Any help would be really appreciated!

     

    Thanks,

    Vinni

    Monday, January 18, 2010 7:55 PM