你"create proc ****"这段Sql 语句还有吧。产生一个sqlconnection,然后用connection产生一个sqlcommand对象,然后运行上面的sql语句就产生存储过程了。

解决方案 »

  1.   

    TheAres(班门斧):
      能不能推荐点文章看看啊,就是有关于 sql 存储过程的。我现在迷糊得很哦。
      

  2.   

    论坛中例子就很多,用“存储过程”search一下看看。
      

  3.   

    SqlConnection nwindConn = new SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind");SqlCommand salesCMD = new SqlCommand("SalesByCategory", nwindConn);
    salesCMD.CommandType = CommandType.StoredProcedure;   //注意这一句SqlParameter myParm = salesCMD.Parameters.Add("@CategoryName", SqlDbType.NVarChar, 15);
    myParm.Value = "Beverages";nwindConn.Open();SqlDataReader myReader = salesCMD.ExecuteReader();Console.WriteLine("{0}, {1}", myReader.GetName(0), myReader.GetName(1));while (myReader.Read())
    {
      Console.WriteLine("{0}, ${1}", myReader.GetString(0), myReader.GetDecimal(1));
    }myReader.Close();
    nwindConn.Close();
      

  4.   

    嗬嗬,谢谢班门斧了,我后来搜索了一下,对于存储过程的了解有很大的进步,今天还突破了在access中使用存储过程这个小问题。:D