【发布时间】:2013-04-26 13:53:42
【问题描述】:
我正在从 mysql 加载我的表,我想创建第一列链接。我的意思是链接到另一个表格。我想显示学生详细信息,当单击名称程序将打开一个新表单并显示有关学生的所有信息。有人知道该怎么做吗?
DataTable table = new DataTable();
MySqlDataAdapter adapsql = new MySqlDataAdapter("SELECT name, surname, dob, sex, nationality, mobile, notes FROM student", connection);
adapsql.Fill(table);
dataGridView1.DataSource = table;
int x = (dataGridView1.RowCount)-1;
label21.Text = Convert.ToString(x);
cmd = connection.CreateCommand();
cmd.CommandText = @"SELECT * FROM reservation";
MySqlDataReader Reader = cmd.ExecuteReader();
if (!Reader.HasRows) return;
while (Reader.Read())
{
reservation.Add(Convert.ToInt16(GetDBString("roomID", Reader)));
}
Reader.Close();
【问题讨论】:
标签: c# mysql datagridview