i have a combobox ,three textbox and one button.when user choose one item in combobox, textboxes and press button,i want to filter corresponding data and show on datagridview!
Please help me!
Thank u so much!

Hey,, You always can try the OnClickEvent of combo boxes to filter data.. i did it in my project as well.. its a simple task ...

1st you have to generate a query to select the items from the db and then filter the results with the items in your combo box.. just delete that button :D :D it will be more easy i guess//

i have 2 table in database,table1 and table2.On my form,i have 1 combobox and 3 textbox,data in combobox get from table1, data in 3 textbox is checked in table2. when user choose and input data,i want to get that data ,check in database then show on datagridview(datagrid referen to table2).My database is a MS access file.
Please help me!
Thank you!

Hey,, You always can try the OnClickEvent of combo boxes to filter data.. i did it in my project as well.. its a simple task ...

1st you have to generate a query to select the items from the db and then filter the results with the items in your combo box.. just delete that button :D :D it will be more easy i guess//

Yes,thank u! i generated a query and show data on combobox.But i don't know how to get results from 3 textbox and 1 combo,then assigned to ONE defaultview and show data on datagrid from this defaultview !
Please help me!

Simple task ,, after loading the DB using the query.. you can assign values to the text fields.. ill show you how ... this is just example that i used ;)

Heres the way to get data from a database via a combobox

string sql = "SELECT * FROM mobile WHERE MMANU = '" + cmbMobtyp.Text + "'";

And here is the way how you assign the SQL field values totext boxez

com = new OleDbCommand(sql, dbcon);
            dreader = com.ExecuteReader();
            dreader.Read();
            textBox1.Text = dreader["MID"].ToString();
            txtModel.Text = dreader["MMNO"].ToString();
            dreader.Close();

in here the MID is a field in my example database table :) and dreader is the data Reader :) Since im a newbie to C# , i cant help you on the GRID VIEW .. i dont have much knowledge about it ;( im sry,,

Hope its clear enough for you :)

Simple task ,, after loading the DB using the query.. you can assign values to the text fields.. ill show you how ... this is just example that i used ;)

Heres the way to get data from a database via a combobox

string sql = "SELECT * FROM mobile WHERE MMANU = '" + cmbMobtyp.Text + "'";

And here is the way how you assign the SQL field values totext boxez

com = new OleDbCommand(sql, dbcon);
            dreader = com.ExecuteReader();
            dreader.Read();
            textBox1.Text = dreader["MID"].ToString();
            txtModel.Text = dreader["MMNO"].ToString();
            dreader.Close();

in here the MID is a field in my example database table :) and dreader is the data Reader :) Since im a newbie to C# , i cant help you on the GRID VIEW .. i dont have much knowledge about it ;( im sry,,

Hope its clear enough for you :)

sorry g2gayan,i don't understand your codes.Now,i want to filter data from 3 textbox and 1 combobox and then show on datagrid.My database is a MS Access file not SQL.
Please help me!
Thank u!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.