select book_category,authers_names,book_name from bookmaster
select Publisher_Name from publishermaster
select quantity_available from BookStock how to bind these 3 tables column values to datagridview(what query should i use) and after selecting combobox value,textbox1 value,textbox2 value i want filter data in dgv.Thank you
Munesh SharmaPosted Apr 7, 2014, 5:48 AM
you do like this
this code when you click on name (which is in combo box) data will be show in textbox.
Click on drop down list in write this code
{
string str = "server = MUNESH\\SQL2008R2;Database=datastore;UID=sa;Password=123;";
SqlConnection con = new SqlConnection(str);
string query = "select * from tablename where name = '"+combobox1.text+"' ";
SqlCommand cmd = new SqlCommand( query,con);
sqldatareader dbr;
try
{
con.open();
dbr = cmd.executereader();
while(dbr.read())
{
string sID = (string) dbr["ID"].tostring;
string sname = (string) dbr["name"] // name is string value
string sage = (string) dbr["age"].tostring;
textbox1.text = sid;
textbox2.text = sname;
textbox3.text = sage;
}
catch(execption es)
{
messagebox.show(es.message);
}
}
}AshokPosted Apr 7, 2014, 5:43 AM
Munesh SharmaPosted Apr 7, 2014, 4:46 AM
Jignesh TrivediPosted Apr 7, 2014, 4:44 AM
I cannot understand you question.
Abhay ShankerPosted Apr 7, 2014, 4:42 AM