更新时间:2022-05-05 06:30:46
我不知道如何在vb中执行此操作但在c#中您可以使用sqldataadapter查询所需的结果。
string studid =你的学生ID
SqConnection myconnection = new SqlConnection(@YourConnectionstring here);
SqlDataAdapter myadapter = new SqlDataAdapter();
myadapter.SelectCommand = myconnection.CreateCommand();
myadapter.SelectCommand.Commandtype = Commandtype.Text;
myadapter.SelectCommand.CommandText =你的查询字符串在这里;
myadapter.SelectCommand.Parameters.AddWithValue(@ param,studid);
DataTable da = new DataTable();
//填充数据表
myadapter.Fill(da);
//在数据表上绑定一个datagridview
DatagridView1.DataSource = da;
我只是一个新手试图帮助...... :)
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.. :)