在HTML中查一下是不是你的字段名写错了,

解决方案 »

  1.   

    语句错了:
    SqlStr="select * from Students where StudentID='" + DropDownList_Students.SelectedItem.Value + "'";
      

  2.   

    string SqlStr="select * from Students where StudentID=" + DropDownList_Students.SelectedItem.Value; 跟踪一下DropDownList_Students.SelectedItem.Value这个值是不是存在?我估计是这个值为空造成的错误
      

  3.   

    string SqlStr="select * from Students where StudentID=" + DropDownList_Students.SelectedItem.Value; 
    --->string SqlStr="select * from Students where StudentID=" + DropDownList_Students.SelectedItem.Value.Tostring();
      

  4.   

    ap9906133是StudentID:StudentID是字符型的吗。。如果是这样。。string SqlStr="select * from Students where StudentID=" + DropDownList_Students.SelectedItem.Value;应该是。。string SqlStr="select * from Students where StudentID='" + DropDownList_Students.SelectedItem.Value + "'";吧。。
      

  5.   

    string SqlStr="select * from Students where StudentID=" + DropDownList_Students.SelectedItem.Value改为
    int id=Convert.ToInt16(DropDownList_Students.SelectedItem.Value )
    string SqlStr="select * from Students where StudentID="+ id
      

  6.   

    string SqlStr="select * from Students where StudentID=" + DropDownList_Students.SelectedItem.Value; 改为string SqlStr="select * from Students where StudentID=" + "'"+DropDownList_Students.SelectedItem.Value.Tostring().Trim()+"'";