多表查询中sql类型不匹配错误
AM 查询 Access 数据库,从两个表中选择记录,在 vb6 中使用以下查询,
SELECT stock.*,suppliers.id, suppliers.s_name as supplier FROM stock,suppliers
WHERE stock.supplier_id=suppliers.id
但当我运行查询时出现以下错误,
-2147467259 Type mismatch in expression. Microsoft JET Database Engine
任何人都可以告诉我出了什么问题,
谢谢
编辑
stock.supplier_id、suppliers.id 都是长整型数据类型
AM querying an access database, selecting records from two tables, in vb6 using the following query
SELECT stock.*,suppliers.id, suppliers.s_name as supplier FROM stock,suppliers
WHERE stock.supplier_id=suppliers.id
but i get the following error when i run the query
-2147467259 Type mismatch in expression. Microsoft JET Database Engine
can anyone tell me what is wrong
thanks
EDIT
Both stock.supplier_id, suppliers.id are long integer data type
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
stock.supplier_id
和suppliers.id
必须具有兼容的类型才能使此等式发挥作用。有一些可用的转换函数,因为您没有提供类型,所以
CStr
应该这样做。此外,我建议您避免隐式连接:
stock.supplier_id
andsuppliers.id
must have compatible types for this equality to work.There a a few converting functions available, since you have not provided the types,
CStr
should do it.Additionally, I would advise you to avoid implicit joins: