vishnu suresh

vishnu suresh

  • NA
  • 53
  • 16.1k

searching in .net regarding each letter.

Dec 24 2014 12:27 AM

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)