C# 后台调用存储过程

首先将它写成单独的方法

我们来定义一个create_pro方法

   

protected  void create_pro ()
        {
            using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["LocalConnectionString"].ConnectionString))
            {
                conn.Open();
                SqlCommand com = new SqlCommand();
                com.Connection = conn;
                com.CommandText = "uppoint_all";//这里的"uppoint_all"就是存储过程的名字
                com.CommandType = CommandType.StoredProcedure;
                com.ExecuteNonQuery();
                conn.Close();
            }
        }

 至于,带参数的调用方法待续

posted @ 2012-03-23 14:50  偶不是大叔  阅读(1626)  评论(0编辑  收藏  举报