首页 > 其他 > 详细

获取存储过程

时间:2016-01-13 19:21:21      阅读:212      评论:0      收藏:0      [点我收藏+]

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!