本文介绍了如何在加载事件后面的代码中调用两个存储过程.......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 你可以在代码隐藏文件里面调用两个存储过程(page_load事件)。 网格视图和datalist有两个控件使用,,,,你怎么能调用两个程序??? protected void Page_Load( object sender,EventArgs e) { if (Page.IsPostBack == false ) { SqlConnection objConn = new SqlConnection (ConfigurationManager.ConnectionStrings [ BuildMyPCConnectionString]。ToString()); objConn.Open(); SqlCommand objCmd = objConn.CreateCommand(); objCmd.CommandType = CommandType.StoredProcedure; objCmd.CommandText = PR_ProductDetail_SelectByPK; objCmd.Parameters.AddWithValue( @ ProductID,Convert.ToInt32(Request.QueryString) [ ProductID])); SqlDataReader objSdr = objCmd.ExecuteReader(); dlProductDetail.DataSource = objSdr; dlProductDetail.DataBind(); } } 这是针对datalist的......你怎么能为gridview调用存储过程.... 解决方案 Can u call the two store procedure inside the code behind file in(page_load event).grid view and datalist there are two control used,,,,how can you call two procedure for that??? protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["BuildMyPCConnectionString"].ToString()); objConn.Open(); SqlCommand objCmd = objConn.CreateCommand(); objCmd.CommandType = CommandType.StoredProcedure; objCmd.CommandText = "PR_ProductDetail_SelectByPK"; objCmd.Parameters.AddWithValue("@ProductID", Convert.ToInt32(Request.QueryString["ProductID"])); SqlDataReader objSdr = objCmd.ExecuteReader(); dlProductDetail.DataSource = objSdr; dlProductDetail.DataBind(); } }this is for datalist ...how can u call store procedure for gridview.... 解决方案 这篇关于如何在加载事件后面的代码中调用两个存储过程.......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-24 23:51