使用select语句调用数据并使用VBScript检查代码列是否具有Test值
<%@ Language=VBScript %>
<%
Function Select()
Dim SQL,Test
SQL = " SELECT code, name, value FROM fruits "
If (strSQL = strSQL & "code = 'Test' ") then
MsgBox("Hello world")
End If
End Function
%>
答案 0 :(得分:1)
尝试类似的事情;
Set Conn = Server.CreateObject("ADODB.Connection") 'db connection
Set RS = Server.CreateObject("ADODB.Recordset") 'Record set
Conn.Open "dsn=YourDNS" 'open the connection
RS.open "SELECT code, name, value FROM fruits WHERE code = 'Test'" ,Conn
if not RS.eof then
if RS.fields("Code").value = "Test" then
MsgBox("Hello World")
end if
end if