2
Answers

searching in .net regarding each letter.

Ask a question

Sir, I hv a pgm in which I want search an item from gridview and displayed on textboxes,if the item number is "c12", then if I type "c" then the grid will display all item starting with c, but nw it shows error it shows only c12 , remaining is not showing, initially the pgm work, but nw it shows this pblm

This is my code

   {
        String str = "select * from MyMast where (CODE like + @search + '%')ORDER BY CODE ASC;";
        SqlCommand xp = new SqlCommand(str, con);
        xp.Parameters.Add("@search", SqlDbType.VarChar).Value = TextBox1.Text;
        con.Open();
        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = xp;
        DataSet ds = new DataSet();
        da.Fill(ds, "CODE");
        GridView1.DataSource = ds;
        GridView1.DataBind();
}


Answers (2)