试一试把student_ID改为字符型,然后
txtSQL="Select * from student_Info Where student_ID=1"看看
你上边那个最后有个空格。

解决方案 »

  1.   

    加两个方括号试试
    txtSql="Select * From Student_Info Where [Student_ID] = 1
      

  2.   

    改正是:
    student_Info where student_ID='1'"
      

  3.   

    data1=txtSQL?如果Data1是DAO控件的话,应该是Data1.recordsource=txtsql
      

  4.   

    谢谢各位,我还是把源码贴上吧
    ...
    txtSQL = "select * from student_Info where student_ID = '" & (CInt(txtSID.Text)) & "'"
    Data1.RecordSource = txtSQL
    Data1.Refresh
    ...
    方括号我加过,不管事
    还请指点!谢
      

  5.   

    student_ID 字段是数据型用
    txtSQL ="select * from student_Info where student_ID = " & (CInt(txtSID.Text)) 
    student_ID 字段是字符型才用
    txtSQL = "select * from student_Info where student_ID = '" & (CInt(txtSID.Text)) & "'"
      

  6.   

    txtSQL = "select * from student_Info where student_ID = '" & (CInt(txtSID.Text)) & "'"
    改为
    txtSQL = "select * from student_Info where student_ID = " & txtSID.Text
    即可
      

  7.   

    txtSQL = "select * from student_Info where student_ID = " & (CInt(txtSID.Text)) & ""
      

  8.   

    问题出在哪一行上?
    是txtSQL = "select * from student_Info where student_ID = '" & (CInt(txtSID.Text)) & "'"
    还是
    Data1.Refresh?是否Cint(txtSID.text)的错误?
      

  9.   

    txtSQL = "select * from student_Info where student_ID = '" & txtSID.TextCint后是个INT型数值,他不能和一个字符串连接啊。
      

  10.   

    txtSQL = "select * from student_Info where student_ID = '" & txtSID.TextCint后是个INT型数值,他不能和一个字符串连接啊。
      

  11.   

    txtSQL = "select * from student_Info where student_ID = " & Val(txtSID.Text) & ""
      

  12.   

    问题出在那?
    是txtSQL=…………
    还是DATA1.refresh是否txtSID.text的数据类型不正确,不能转换为INT型
    改成CINT(val(txtSID.Text))试试