Arc*_*are 0 database sql-server asp-classic
首先,请原谅我,如果这是一个奇怪的问题,但很明显不适合我.
我试着这样做:
sql="SELECT Alerts.id, Alerts.id_person, Alerts.type, Alerts.date,
People.id, People.name, FROM Alerts, People
WHERE People.name='"& name &"' AND People.id=Alerts.id_person"
set RS=oADO.Execute(sql)
Run Code Online (Sandbox Code Playgroud)
但是,由于Alerts和People都有一个名为id的字段,因此我在引用它们时遇到问题.我不被允许做,
RS.Fields("Alerts.id")
或者RS.Fields("People.id")
只是RS.Fields("id")
这不让我选择我想要使用的领域(实际上我需要同时使用它们).
我无法改变DDBB的结构(它还没有由我制作).
我能做什么的暗示?非常感谢你.
我忘了说这会选择很多条目,我会和他们一起玩
While not RS.EOF
Lorep Ipsum
Wend
Run Code Online (Sandbox Code Playgroud)
您可以在select语句中使用"as"为列名创建别名:
例: People.id as PersonID
sql="SELECT Alerts.id, Alerts.id_person, Alerts.type, Alerts.date,
People.id as PersonID, People.name, FROM Alerts, People
WHERE People.name='"& name &"' AND People.id=Alerts.id_person"
Run Code Online (Sandbox Code Playgroud)
这允许您使用:
RS.Fields("PersonID")
Run Code Online (Sandbox Code Playgroud)