|
JohnH -> Retrieving a field from a SQL and using as variable (5/9/2008 10:36:24)
|
I have simple query of a SQL database, I want to be able to pull a field from the database and then use it elsewhere in my ASP page. I attempted this using the code below but I don't get anything back when I use the variable. <%
Dim req_no
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=server;UID=user;PWD=password;DATABASE=dbase"
Set rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT REQUISITION_NO FROM REQUISITION_MASTER WHERE CREATION_DATE ='" & (CREATION_DATE) & "' AND CREATION_TIME='" & CREATION_TIME & "'"
rs.open SQL, conn
req_no = rs("REQUISITION_NO")
conn.close
Set rs = Nothing
Set conn = Nothing
%> I am referencing the viariable by using <%=req_no%> Many thanks, John
|
|
|
|