【发布时间】:2015-07-03 02:01:37
【问题描述】:
我对@987654322@ 的功能及其工作方式不是很有信心,我是否可以为每个找到的与 SQL 查询对应的StudentID 创建一些东西,它将每个 ID 显示在不同的标签中?如果可以,请您帮助我了解如何实现这一目标。
这是我目前使用 SQL 查询的代码:
private void SetTestsForm_Load(object sender, EventArgs e)
{
string y = GlobalVariableClass.Signedinteacher;
string connectionString = ConfigurationManager.ConnectionStrings["myconnectionstring"].ConnectionString;
SqlConnection connect = new SqlConnection(connectionString);
connect.Open();
SqlCommand command20 = new SqlCommand(@"SELECT [StudentID] FROM StudentDetails WHERE ([TeacherID] = @signedinteacher)", connect);
command20.Parameters.AddWithValue("@signedinteacher", y);
SqlDataReader reader = command20.ExecuteReader();
}
【问题讨论】:
-
如果您在此问题上找到“部分员工”(答案)(本评论末尾的网址)......您将找到一种更“分层”的方法来解决您的问题。在您设计软件时,我会搜索“分层应用程序”。 stackoverflow.com/questions/13650443/…
标签: c# sql sql-server select label