Click here to Skip to main content
15,894,410 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
display data in list view with where clause where random_no = textbox2.text.
this is m code

private void BindListView()
{
//SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());

string constr = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "select * from descroption where [random_no] = '"+ TetxBox2.Text+"' ";
cmd.Connection = con;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
DataTable dt = new DataTable();
sda.Fill(dt);
ListView3.DataSource = dt;
ListView3.DataBind();
}
}
}
}


want to show data where textbox value same
Posted
Comments
Rajesh waran 13-Oct-14 5:17am    
what's your error? where u struck?
Prakriti Goyal 13-Oct-14 5:18am    
Hi,

Check the spelling of Textbox in your code(query).
Divyam Sharma 13-Oct-14 7:27am    
Not getting your actual error

1 solution

HI Aarti,

You can create a filter data-table to select the filtered data on it and show that to the list view.

C#
Datatable tempFilterData = _dt.Select("random_no = " + textbox.text).CopyToDataTable();


Then use the filtered datatable to be shown on the listview.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900