首先将它写成单独的方法
我们来定义一个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();
}
}
至于,带参数的调用方法待续