Code:
set conn = CreateObject("ADODB.Connection")
set sqlconn = CreateObject("ADODB.Connection")
set rs = CreateObject("ADODB.Recordset")
set conn = CreateObject("ADODB.Connection") 'prep connection'
conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=" & sqlserver & ";UID=" & sqluser &_
";PWD=" & sqlpwd & ";DATABASE=" & sqldb
...
query = "Select pluw, plua from agents where code = " & agentcode
rs.open query, conn
response.write query & "<BR>"
'response.write rs.fields("pluw") & " - " & rs.fields("plua") & "<BR>"
if rs.eof then
response.write "<font color=red><b>Agent Code not found</b></font><br><br>"
I'm connecting to SQL and running a query to return user initials for the specified code. Code is my primary key for the table. There are no other indexes or keys on the table.
The data I had in the table prior to creating the asp page is returned when entering its code. But if a new record is created, the asp page returns nothing and displays agent code not found. But i can copy the query generated by the asp page and have query analyzer return the record.
why cant I retrieve new records from sql using the asp page?