将SQL代码转换为VBScript(经典ASP)

时间:2012-10-05 20:26:51

标签: sql asp-classic

我想在经典的.asp

中转换下面的代码(在SQL中)
select nomerazaosocial from tab_participante where participanteid in (
SELECT       ParticipanteId
FROM         dbo.Rel_Grupo_Participante
where grupoid in (6,110))

由于

1 个答案:

答案 0 :(得分:1)

在询问之前,询问者应该尝试独立解决问题。你的问题没有任何意义,因为你本身不能“转换”任何东西 - 所以这对你几乎没有帮助。

无论如何,请通过谷歌搜索阅读,例如: “经典的asp数据库查询”,您将找到开始的示例,如:

<html>
<title>Queries from the MS-SQL database with ASP</title>
<body bgcolor="FFFFFF">
<h2>Query from table <b>products</b> with ASP</h2>

<%

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "PROVIDER=SQLOLEDB;DATABASE=PiccoCeraci"

'This code block will create a recordset
Set rs = Server.CreateObject("ADODB.Recordset")
SQL = "select * from products"
rs.open SQL, conn

'will iterate to display the records got from the database
While Not rs.EOF
response.write(rs("id") & " " & rs("price"))
rs.MoveNext
Wend

'closes the connection
rs.close
conn.close
Set rs = Nothing
Set conn = Nothing

%>
</body>
</html>

source