这原来是使用Access数据库时的一sql语句,现在改为sql server,运行报错.
Dim sql as string
Dim rs as New ADODB.Recordset
sql="select * from t_Customer Ta, t_Book Tb, t_Count Tc"
set rs=getrecordset(sql)
.Rows = 3
If Not rs.EOF Then
Do While Not rs.EOF
TextMatrix(Row-1,0)=Trim(rs("Ta.id"))
运行时报错.调试TextMatrix(Row-1,0)=Trim(rs("Ta.id"))这一句的时候,显示:
Item cann't be found in the collection correspanding to the requested name of ordinal
我要的是表Ta 中的id又比如:
sql="slelect * from t_A Ta,t_B Tb,t_C Tc when Ta.CusId=Tb.ID And Ta.BookID=Tc.ID and Td.Cus='" & Cus & "' "
set rs=getrecordset(sql)
txtID.text = rs("Tc.id")
出现的错误同上,同样,我也是要表Tc中的id.
Dim sql as string
Dim rs as New ADODB.Recordset
sql="select * from t_Customer Ta, t_Book Tb, t_Count Tc"
set rs=getrecordset(sql)
.Rows = 3
If Not rs.EOF Then
Do While Not rs.EOF
TextMatrix(Row-1,0)=Trim(rs("Ta.id"))
运行时报错.调试TextMatrix(Row-1,0)=Trim(rs("Ta.id"))这一句的时候,显示:
Item cann't be found in the collection correspanding to the requested name of ordinal
我要的是表Ta 中的id又比如:
sql="slelect * from t_A Ta,t_B Tb,t_C Tc when Ta.CusId=Tb.ID And Ta.BookID=Tc.ID and Td.Cus='" & Cus & "' "
set rs=getrecordset(sql)
txtID.text = rs("Tc.id")
出现的错误同上,同样,我也是要表Tc中的id.
解决方案 »
- 用VBA把WORD文档存成TXT时,中文出现乱码??(内附代码)
- VB以前能用的程序数据库重新导入之后就不能用了
- 用command对象打开存储过程得到的记录集居然提示"不支持更新..."
- VB简单问题
- VB如何调用嵌入到GIS中的dll插件?
- 大家是怎么学习使用用vb中的控件的?交流
- 为什么我的VB 6.0没有 Scripting 类型库?(在线等待)
- Access访问的问题:当前用户没有权限转换或启用该数据库。
- 今天是a号(如:2002-02-03),求23个月后是多少号,怎么写代码?
- 一道难题!(被情所困)
- 怎么让web browser和 IE共亨cookies值呢??
- 打印,OpenPrinter为0!为什么?
2,将语句放入SQL的查询分析器执行,看看有没有tc.id这一列
sql="slelect * from t_A Ta,t_B Tb,t_C Tc when Ta.CusId=Tb.ID And Ta.BookID=Tc.ID and Td.Cus='" & Cus & "' "
-->
sql="slelect *,tc.id as tcid from t_A Ta,t_B Tb,t_C Tc when Ta.CusId=Tb.ID And Ta.BookID=Tc.ID and Td.Cus='" & Cus & "' " set rs=getrecordset(sql)txtID.text = rs("Tc.id")--->txtID.text = rs("Tcid")