Recordset problem?
Hi, i'm trying to get ASP.net to talk to a Faircom database, not having much luck. I read somewhere that ADO recordsets no longer exist, so have tried converting to a dataset without much luck. Is there anything obviously wrong with this code? Any ideas on how i can get it running?
Cheers, John.R
'if session("notfound")="TRUE" then
'label1.text = "The last entered card: " & =session("CardNo") & " Could not be found."
'session("notfound") = ""
'session("CardNo") = ""
'end if
Sub Button1_Click(sender As Object, e As EventArgs)
dim cardid
Dim rst, URLline, CardNo, CardName, CardBalance, i, Temp, myconnection, strsql, test, AccountNo, NewCardID
i = "0"
cardid = txtCardID.text
if cardid = "" then
lblresult.text = "No ID Entered."
else
lblresult.text = cardid
'connect
myconnection = Server.CreateObject("ADODB.Connection")
myconnection.connectionstring = "File Name=c:\faircom.UDL;"
myconnection.open
rst = Server.CreateObject("ADODB.recordset")
'query
strsql = "Select * from Prim where Name ='" & cardid & "'"
rst.open(strsql,myconnection)
if rst.eof = false then
' CardNo = trim(rst(0))
' CardName = rst(1)
' CardBalance = rst(17)
' NewCardID = rst(2)
lbl1.text = rst
' lbl2.text = CardBalance
else
'Response.Redirect ""
lbl2.text = rst
end if
end if
End Sub
|