积极答复者
gridview数据源sqldatasource调用存储过程,刷新结构报错.

问题
答案
全部回复
-
您说的各种参数是什么意思呢?
我现在就是用的一个类,里面是运行存储过程返回第一个datatable,还有什么问题吗?1 public DataTable GetDataSource(int userID, int GridID, string GridDaiMa, string Xmlwhere, string Language) 2 { 3 string strSQL = ""; 4 if (Xmlwhere == null) 5 { 6 strSQL = "declare @m_Ret integer execute sp_CommonCodeTableQueryTest " + userID + "," + GridID + ",'" + GridDaiMa + "',null,'" + Language + "'"; 7 } 8 else 9 { 10 strSQL = "declare @m_Ret integer execute sp_CommonCodeTableQueryTest " + userID + "," + GridID + ",'" + GridDaiMa + "',N'" + Xmlwhere + "','" + Language + "'"; 11 } 12 return wsDB.GetSqlDataSet(strSQL).Tables[0]; 13 } 14 15 16 17 public DataSet GetSqlDataSet(string paraSql) 18 { 19 DataSet ds = new DataSet(); 20 21 using (SqlConnection conn = new SqlConnection(conStr)) 22 { 23 SqlDataAdapter da = new SqlDataAdapter(); 24 SqlCommand cmd = new SqlCommand(paraSql, conn); 25 cmd.CommandTimeout = 100000; 26 da.SelectCommand = cmd; 27 da.MissingSchemaAction = MissingSchemaAction.AddWithKey; 28 da.Fill(ds); 29 } 30 31 return ds; 32 }