我从早上开始非常困难,有人可以帮助我 我有一个没有返回任何值的SQL数据适配器。在顶部的同一页面中我有一个SQldataadaptor工作正常。我不知道该怎么办 。查询在服务器中正常工作。我正在使用vs10和sqlserver 2008 ..
我还尝试删除它仍然无效的参数'。我的行数始终为零
这是我的代码
doc = dr["DrName"].ToString();
sql1 = "select w.Day, w.Start,[End] from WeeklyScheduleDays w where w.Start is not null and w.Day = @day1 and WeeklyScheduleID = (select WeeklyScheduleID from DoctorsBusinessHours db inner join drmast m on m.DoctorId = db.DcotorID where m.DrName = '@drname2') order by Start ";
SqlCommand m1 = new SqlCommand(sql1,myConnection);
m1.Parameters.AddWithValue("@day1", i);
m1.Parameters.AddWithValue("@drname2", doc);
SqlDataAdapter ad = new SqlDataAdapter(m1);
DataTable t1 = new DataTable();
ad.Fill(t1);
rowcount = t1.Rows.Count;
提前致谢
答案 0 :(得分:1)
将where m.DrName = '@drname2'
替换为where m.DrName = @drname2