标签:
1.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();
}
2.
SqlConnection conn = new SqlConnection(connectionstring);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand();
da.SelectCommand.Connection = conn;
da.SelectCommand.CommandText ="NameOfProcedure(’para1’,’para2’,para3)";
da.Selectcommand.CommandType = CommandType.StoredProcedure;
3.
SqlCommand cmd = new SqlCommand("proc_3", con);//同上
cmd.CommandType = CommandType.StoredProcedure;//同上
SqlDataAdapter da = new SqlDataAdapter(cmd);//用SqlDataAdapter执行
DataTable table = new DataTable();//创建一张表
da.Fill(table);//填充表
return table;
标签:
原文地址:http://www.cnblogs.com/zhubenxi/p/5127856.html