Click here to Skip to main content
16,009,640 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hey guys, sorry about my english, What im trying to do here is:

I already have a database for students, this is just a test but i have the id, names and other info about those students,

and i want to program some visual basic application that when i enter the students ID it will display the rest of the info about the student, so how do i do that? x)
Posted

1 solution

i don't know how to do it in vb but in c# you can use an sqldataadapter to query the results you want.



string studid = "Your student id"

SqConnection myconnection = new SqlConnection(@"YourConnectionstring here");
SqlDataAdapter myadapter = new SqlDataAdapter();
myadapter.SelectCommand = myconnection.CreateCommand();

myadapter.SelectCommand.Commandtype = Commandtype.Text;
myadapter.SelectCommand.CommandText = "Your Query String here";
myadapter.SelectCommand.Parameters.AddWithValue("@param",studid);

DataTable da = new DataTable();

//fill the datatable

myadapter.Fill(da);

//bind the your a datagridview on the datatable

DatagridView1.DataSource = da;





I'm just a newbie trying to help.. :)
 
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