用strsql = "select * from students A,class1 B where A.classno=B.classno"
我想读取表class1里面的记录但老是读的是students的记录
代码如下:
Comclassno.AddItem rs.Fields(0)
但是读的是students的第一个字段的值,我想读取class1的第一个字段该怎么写啊
谢谢了

解决方案 »

  1.   

    select b.* from student a,class1 b where a.classno = b.classno
      

  2.   

    这样一来不是只读取class1记录,我想students,class1都可以读取啊,能不能说一下students
    怎么读取,class1怎么读取,
      

  3.   

    select student.a as a1,class1.a as b, ...
      

  4.   

    select student.a as a ,class.b as b from student a,class1 b where a.classno = b.classno
      

  5.   

    select a.series_id ,b.series_id from tblbooklog a ,tblconsultform b where a.series_id = b.series_id and b.form_type='A'上面那个我写的可能是不对的
    这个我试验过了,可以读出a和b中字段名相同的字段所对应的值.你改一下就可以用了
      

  6.   

    b.form_type='A'
    是什么意思啊,小弟不是很懂
      

  7.   

    取得是并集select * from students right outjoin class1
    on students.classno=class1.classno
      

  8.   

    象这样一来select a.studentid ,b.studentid from students a ,class1 b where a.studentid = b.studentid and b.form_type='A'
    那么去记录时怎么表达啊,
    rs("a.student")是不是这样子啊,还是怎么表达啊
      

  9.   

    你这个语句没有指定别名,所以只能
    rs!field(0)和rs!field(1)这样用
    或者
    select a.studentid as FirstID ,b.studentid as SecondID from students a ,class1 b where a.studentid = b.studentid and b.form_type='A'则可以rs.Fields("FirstID")这样引用了
      

  10.   

    列名b.form_type='A'无效,能不能去掉啊
      

  11.   

    我把b.form_type='A',但是访问不到b.studentid 老是a.studentid的
      

  12.   

    strsql="select a.* ,b.* from students a,class1 as b where a.classno=b.classno"
      

  13.   

    strsql="select a.* ,b.* from students a,class1  b where a.classno=b.classno"
      

  14.   

    这样一来就不能区分classno拉我想用到b.classno怎么调用啊
      

  15.   

    用strsql = "select * from students A,class1 B where A.classno=B.classno"
    我想读取表class1里面的记录但老是读的是students的记录
    代码如下:
    Comclassno.AddItem rs.Fields(0)
    但是读的是students的第一个字段的值,我想读取class1的第一个字段该怎么写啊假设studends表中的字段:id,mc,classid
    class表中的字段:id,mc
    strsql= "select students.id,students.mc,students.classid,class.id,class.mc from students class where students.classid=class.id"然后读取:rs.Fields(0)  'students.id
    rs.Fields(4)  'class.id
    或者
    rs.Fields(class.id)
      

  16.   

    我用了strsql = "select students.classno,students.name,students.age,students.address,students.sex,class1.classno from students class1 where students.classno=class1.classno"
    但提示列前缀'students'与查询中所用的表名或别名不匹配.
      

  17.   

    我写的那个是个我在本地的测试用的语句啦
    form_type = 'A'就是form_type这个字段的值='A'啊
    当然这句话可以换成其他的条件句
      

  18.   

    strsql = "select B.Flie1,B.Flie2……B.FlieN from students A,class1 B where A.classno=B.classno"
      

  19.   

    strsql = "select * from students A,class1 B where A.classno=B.classno"
    这里的错误是有相同字段,如:a.classno和b.classno,使用如下试一下应当成功:
    strsql="select a.* from students a,class1 b where a.classno=b.classno"
      

  20.   

    strsql = "select * from students A,class1 B where A.classno=B.classno"
    这里的错误是有相同字段,如:a.classno和b.classno,使用如下试一下应当成功:
    strsql="select b.* from students a,class1 b where a.classno=b.classno"用下面即可: 
     Comclassno.AddItem rs("classno")
      

  21.   

    Dim mycommection As Connection
    Dim myrecordset As RecordsetPrivate Sub showfld()
     Dim i As Integer
     For i = 0 To 6
       Text1(i).Text = myrecordset(i + 1)
     Next i
    End Sub
      

  22.   

    欲读取class1的第一个字段,可以给该字段取别名,然后在记录集中通过字段名称来引用不就行了,至于你为什么总是读取的是student表中的字段是因为student表列在class1表的前面,在字段排列时其字段在前,将语句改为如下:
    strsql = "select a.*,b.classno as classB from students A,class1 B where A.classno=B.classno"
    后使用
    Comclassno.AddItem rs("classB") 或者comclassno.AddItem rs!classB均可,或者你数一下该字段应位于第几列,comclassno.AddItem rs.Fields[i]
      (设class1表classno位于第i列)