以下是我在C#中添加的从数据库导出信息的代码:
string sql = string.Format("select count(*) from SelfRoom where classRoomID='{0}' and ChairNo = '{0}'",classRoomID,ChairNo );
if (panduan(sql) <= 0)
{
MessageBox.Show("您查询的数据不存在!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox2.Focus();
textBox2.SelectAll();
textBox3.SelectAll();
}
else
{
dataGridView12.DataSource = uis.GetAllUseInfo().Tables[0];
}
要求通过教室编号(classRoomID)和椅子编号(ChairNo)来查询信息,在数据库中对应的表是SelfRoom,textBox2中输入教室编号,textBox3中输入椅子编号则在点击查询时在dataGridView12中显示符合教室编号和椅子编号的表中的信息多谢大家
string sql = string.Format("select count(*) from SelfRoom where classRoomID='{0}' and ChairNo = '{0}'",classRoomID,ChairNo );
if (panduan(sql) <= 0)
{
MessageBox.Show("您查询的数据不存在!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox2.Focus();
textBox2.SelectAll();
textBox3.SelectAll();
}
else
{
dataGridView12.DataSource = uis.GetAllUseInfo().Tables[0];
}
要求通过教室编号(classRoomID)和椅子编号(ChairNo)来查询信息,在数据库中对应的表是SelfRoom,textBox2中输入教室编号,textBox3中输入椅子编号则在点击查询时在dataGridView12中显示符合教室编号和椅子编号的表中的信息多谢大家
http://blog.csdn.net/jeryler/article/details/6625680
string sql = string.Format("select count(*) from SelfRoom where classRoomID='{0}' and ChairNo = '{1}'",classRoomID,ChairNo );
我觉得是不是这该改下?
2. 检查你的panduan方法是否正确。
3. 如果数据存在的话,你为何要绑定所有的用户信息?这个时候应该是从数据库查询出来的数据。any way,漏洞很多,多检查多修改.
中Tables[0]还改吗?教室编号(classRoomID)和椅子编号(ChairNo)是一个表里的两个字段。。谢了