如何在数据库查询上添加@? [英] How to add @ on database query?
本文介绍了如何在数据库查询上添加@?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想添加查询@psgc_code。我加入两张表来做到这一点。我说附加信息:'='附近的语法不正确。
我尝试过:
I want to add on the query @psgc_code. I join two table to do that. i says "Additional information: Incorrect syntax near '='."
What I have tried:
Dim sql As String
sql = "SELECT i.PSGC_code, i.ResDate, i.RespondentID, h.LGU_name , h.LGU_type
from LGUProfile as i, PSGC as h
where i.PSGC_code = h.PSGC_code ='" & "@psgc_code" & "'"
推荐答案
阅读有关SQL JOIN的方法。试试这个 [ ^ ]。
您的SELECT应该更像:
Read up on how to do SQL JOIN. Try this[^].
Your SELECT should look more like:
SELECT i.PSGC_code
, i.ResDate
, i.RespondentID
, h.LGU_name
, h.LGU_type
FROM LGUProfile AS i
JOIN PSGC AS h
ON i.PSGC_code = h.PSGC_code
WHERE i.PSGC_code=@psgccode
当然,你'必须提供适当的VB.NET代码来设置对数据库引擎的调用,并提供带有相应参数对象的命令以传入@psgccode。
Of course, you're going to have to supply appropriate VB.NET code to setup the call to the database engine and supply the command with the appropriate parameter object to pass in your @psgccode.
这篇关于如何在数据库查询上添加@?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文