float PriceList;SqlParameter parameterPrice = new SqlParameter("@Price", SqlDbType.Money, 8);
parameterPrice.Value = PriceList;(我想让PriceList传到参数中咋办)
myCommand.Parameters.Add(parameterPrice);

解决方案 »

  1.   

    public static SqlParameter MakeParam(string ParamName, SqlDbType DbType, Int32 Size, ParameterDirection Direction, object Value)
    {
    SqlParameter param; if (Size > 0)
    param = new SqlParameter(ParamName, DbType, Size);
    else
    param = new SqlParameter(ParamName, DbType); param.Direction = Direction;
    if (!(Direction == ParameterDirection.Output && Value == null))
    param.Value = Value; return param;
    }
      

  2.   

    SqlParameter  mypara1 = new SqlParameter();
    SqlParameter mypara2 = new SqlParameter();
    SqlParameter mypara3 = new SqlParameter(); mypara1.ParameterName = "@au_lname";
    mypara1.Direction = ParameterDirection.Input;
    mypara1.SqlDbType = SqlDbType.NVarChar;
    mypara1.Value = "White";
    mypara2.ParameterName = "@intID";
    mypara2.Direction = ParameterDirection.Input ;
    mypara2.SqlDbType = SqlDbType.Int;
    mypara2.Value = i;

    mypara3.ParameterName = "@intIDOut";
    mypara3.Direction = ParameterDirection.Output;
    mypara3.SqlDbType = SqlDbType.Int;
    mypara3.Value = j ;

    mySqlDataAdapter.SelectCommand.Parameters.Add(mypara1);
    mySqlDataAdapter.SelectCommand.Parameters.Add(mypara2);
    mySqlDataAdapter.SelectCommand.Parameters.Add(mypara3); //mySqlDataAdapter.SelectCommand.Parameters.Add("@intIDOut", j);//ParameterDirection.Output

    myDataSet = new DataSet();
    //str = ParameterDirection.Output.ToString();
    mySqlConnection.Open();
            mySqlDataAdapter.Fill(myDataSet, "authors");
    mySqlConnection.Close();
      

  3.   

    这样不行吗?不行的话你就这样写
    SqlParameter parameterPrice = new SqlParameter("@Price", SqlDbType.Money, 8);
    parameterPrice。Direction=ParameterDirection.Input;
    myCommand.Parameters.Add(parameterPrice);
    parameterPrice.Value = PriceList;(我想让PriceList传到参数中咋办)
      

  4.   

    那你合不用这种呢
    dbCommand.Parameters[":ID"].Value = obj.ID;
    if(Doc.PayTime == new DateTime(1,1,1))
    dbCommand.Parameters[":PAYTIME"].Value = DBNull.Value;
    else
    dbCommand.Parameters[":PAYTIME"].Value = obj.PayTime;
    obj.PayTime这里你你就可以给PriceList
    不知道你是不是这个意思!