我想通过使用存储过程来搜索显示在网格视图中的记录,但没有得到 [英] i would like to search records show in grid view by using stored procedure but it is not getting
本文介绍了我想通过使用存储过程来搜索显示在网格视图中的记录,但没有得到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用存储过程来搜索显示在网格视图中的记录,但是没有得到说,
找不到存储过程"serachdetails9".
这是我的代码....
i would like to search records show in grid view by using stored procedure but it is not getting , saying
Could not find stored procedure ''serachdetails9''.
this is my code....
SqlConnection con = new SqlConnection("Data Source=........ Catalog=........;Integrated Security=True");
SqlCommand cmd = new SqlCommand("serachdetails9", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
string str = "%" + TextBox1.Text + "%";
cmd.Parameters.AddWithValue("@UserName", SqlDbType.VarChar).Value = str;
SqlDataReader dr = cmd.ExecuteReader();
dr.Close();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
推荐答案
尝试此操作.可能对您有所帮助.
Try this.. may help you.. if store procedure is correct.
string str= " like '%" + TextBox1.Text+ "%'";
这篇关于我想通过使用存储过程来搜索显示在网格视图中的记录,但没有得到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文