[pic]

[ Home ] [ Discuss ] [ Documentation ]
Search:

 

 
ASP Source Code:
<%@ Language = VBScript %>
<%option explicit%>
<html>
<head>
<title>SQL Example</title>
<link rel="stylesheet" href="/core.css">
</head>

<body>
<!-- #include virtual="/header.html" -->

<center><h1>Basic query</h1></center>
<p>
The following is a very simple example of connecting to a querying a
QICWARE ODBC data source.
The <a href="./source.asp?file=<%= right(Request.ServerVariables("PATH_INFO"), len(Request.ServerVariables("PATH_INFO"))-instrrev(Request.ServerVariables("PATH_INFO"), "/")) %>">source code</a> to this sample page is also available.
</p>

<p>
<%
dim oConn, oRs, sql

SET oConn = Server.CreateObject("ADODB.Connection")
if oConn = null then
  abort()
end if

oConn.Open "DSN=qcd;UID=qsql;Password=pa$$w0rd;"
if oConn = null then
  abort()
end if

sql="select * from DEPARTMENTS"
set oRs = oConn.Execute(sql)

WHILE NOT oRs.EOF
  response.write oRs.Fields("DEPARTMENT_CODE").Value & " "  &  oRs.Fields("DEPARTMENT").Value & "<br/>"
  oRs.MoveNext
WEND
%> 
</p>

<!-- #include virtual="/footer.html" -->
</body>
</html>
© 1999-2019, Qantel Technologies, Inc.