解决方案 »

  1.   

    SqlParameter[] par = new SqlParameter[2];
    par[0] = new SqlParameter("@TA", SqlDbType.VarChar);
    par[1] = new SqlParameter("@ST", SqlDbType.VarChar);
    par[0].Value = var;
    par[1].Value = status;        public int NewExecuteQuery(string sql, SqlParameter[] para)
            {
                SqlTransaction odt=null;
                int result=0;
                try
                {
                    sqlconnection.Open();
                    odt = sqlconnection.BeginTransaction();
                    result = ExecuteNonQuery(odt, CommandType.Text, sql, para);
                    odt.Commit();
                    return result;
                }
                catch (Exception ex)
                {
                    odt.Rollback();
                    throw new Exception(ex.Message, ex);
                }
                finally
                {
                    sqlconnection.Close();
                }
            }
    随便举个例子
      

  2.   

    为什么不你不看看MSDN上关于SqlParameter的介绍,其实MSDN是最好的文档了。