Please tell me the code for how to display record in datagridview based on combobox selected item.
I have a table named table1 in sql server database.and columns are name,id,group,grade,year.when i seleted one name from my table then the remaining fields information(ie only that record)have to dispaly in datagridview by click on the 'Display' button.

sqlcommand cmd =new sqlcommand;
cmd.commandtext="select id, group,grade,year where name='"+combobox_selected item+"'"
sqldataadapter da=new sqldataadapter;
datatable dt=new datatable();

Hope this will help you....

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.