本文介绍了关于Gridview数据绑定选择下拉列表项并搜索btn点击给出结果...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何一个人都可以告诉你失败,becoz它不会给记录空集返回
Can any one tell actully wht is missing ,becoz it not give record empty set is return
String strConnString = ConfigurationManager.ConnectionStrings["con"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Flag", 112);
cmd.Parameters.AddWithValue("@Para1",SqlDbType.NVarChar).Value=secnm;
cmd.CommandText = "spSelect";
cmd.Connection = con;
// Filling Data to Gridviewsearch in View3
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
spSelect商店程序:
spSelect Store Procedure:
ELSE IF @Flag=112
BEGIN
SELECT Team.tcode, Team.tnm, Section1.sdesc
FROM Team INNER JOIN
Section1 ON Team.sec_id = Section1.sec_id
WHERE (Section1.sdesc = @Para1)
END
推荐答案
cmd.Parameters.AddWithValue("@Para1",SqlDbType.NVarChar).Value=secnm;
到
to
cmd.Parameters.Add("@Para1",SqlDbType.NVarChar,-1).Value=secnm;
这篇关于关于Gridview数据绑定选择下拉列表项并搜索btn点击给出结果...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!