求救各位大侠
protected void SetBind()
{
try
{
sql = "select Sno as 学号 ,Sname as 姓名 ,deptName as 系名 ,StartDate as 入学时间 ,CreditHours as 学分 from Students,Depts where Students , Depts where Students.DeptNo = Depts.DeptNo";
ds = con.BindDataGridView(dataGView, sql);
dataGView.Columns[0].ReadOnly = true;
dataGView.Columns[4].ReadOnly = true;
dataGView.AllowUserToAddRows = false;
}
catch
{
MessageBox.Show("不能做该操作!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
以上程序设置断点运行后系统总是提醒“,”附近有错误,但是本人总是找不到问题的症结所在!(程序总是执行到ds = con.BindDataGridView(dataGView, sql);就直接跳转到catch)!
另外为什么程序都不能执行try了,直接执行catch,当把“不能做该操作”对话框关闭后,程序仍然能够自动显示该程序锁创建的winform??
[解决办法]
里面怎么有两个where不是应该一个吗
[解决办法]
sql = "select Sno as 学号 ,Sname as 姓名 ,deptName as 系名 ,StartDate as 入学时间 ,CreditHours as 学分 from Students,Depts where Students , Depts where Students.DeptNo = Depts.DeptNo";
你的Sql语句有问题,调试看看,跟踪代码看下Sql语句的值是什么!
[解决办法]