Drag and down a combobox from toolbox and 3 text box for ID,name, and age. Make a function for getting database value (Name) in combobox and after click at any name then show all detail of that respected persion.
Click on combobox 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);
}
}
}