关于列前缀与查询中所用的表名或别名不匹配的问题
做了一个VB连接SQL2000的程序,并运行SQL语句创建几个表,但运行的时候出现如下错误:[Microsoft][ODBC sql server driver][sql server]列前缀't_icitemcore'与查询中所用的表名或列名不匹配。
我如果在服务器的SQL2000查询分析器中直接运行下面包含的SQL语句是没问题的,放到VB代码中就出现这个错误,请高手看看到底是哪里错了,是不是写错了,在线等,万分感谢!!
Private Sub Command1_Click()
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
conn.C
conn.ConnectionTimeout = 30
conn.Open
rs.Open "select fitemid,fqty Into richard1 From iccustbomchild where finterid=(select finterid From icbom where fbomnumber='custbom000001')", conn, adOpenKeyset
rs.Open "select fnumber,fname,fmodel,fqty Into richard2 from t_ICItemCore innr join richard1 on t_ICItemCore.fitemid=richard1.fitemid", conn, adOpenKeyset
rs.Open "select finterid,fitemid,fqty Into richard3 From icbomchild where finterid in(select finterid From icbom where fitemid in(select fitemid From t_icitemcore where fnumber in(select fnumber From richard2 where fnumber like '2.%')))", conn, adOpenKeyset
rs.Open "select fnumber as 物料代码,fname as 物料名称,fmodel as 规格型号,fqty as 用量 Into richard4 from t_icitemcore inner join richard3 on t_icitemcore.fitemid=richard3.fitemid", conn, adOpenKeyset
rs.Open "select * from richard4"
Dim i As Long
Text1.Text = "物料编码" & " - " & "名称" & " - " & "规格型号" & " - " & vbCrLf
For i = 0 To rs.RecordCount - 1
Text1.Text = Text1.Text & rs.Fields(0).Value & " - " & rs.Fields(1).Value & " - " & rs.Fields(2).Value & " - " & rs.Fields(3).Value & vbCrLf
rs.MoveNext
Next
rs.Close
End Sub