I have a select statement that narrows the records down to one (ex. A UserID). Something that I want out of that row is to set the variable strFirstName to the value in the "FirstName" column in my record. How do I do that?
if you have a SELECT that is selecting only one row in the DB to populate the rs. then it does just that. populates the entire row into the rs. so in theory from your question you should jsut be able to say
strFirstName = rs("FirstName"
rs being the populated recordset from the sql execute _________________________________________________________
for the best results to your questions: FAQ333-2924
[sub]01001111 01101110 01110000 01101110 01110100[/sub]
If not objrs.eof then
strFirstName = objrs("firstName"
end if Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179 It's sad that some Americans proudly turn their backs on the very Flag the gives them the opportunity to do just that... - Mike
I can't seem to get a recordset set up. Can I use a DataReader? See the code marked with ">>>>>>". I get an OutOfRangeException error with this. Thanks for your help.
Sub LoginBtn_Click(Sender As Object, E As EventArgs)
Dim conn as OleDbConnection
Dim cmd as OleDbCommand
Dim dbReader as OleDbDataReader
Dim result as string
' Create Connection using OLEDB
conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\TEST.mdb")
Dim strSQL as string = "select Email FROM LOGIN WHERE Email='" & txtEmail.Text & "' AND Password='" & txtPassword.Text & "'"
conn.open()
cmd = new OleDbcommand(strSQL,conn)
dbReader = cmd.executereader
' Bind result to repeater control
DataGrid1.datasource = dbReader
DataGrid1.databind()
If DataGrid1.Items.Count = 1 Then
>>>>>> Dim strName = dbReader("FirstName"
Response.Cookies("userInfo"("Name" = strName
Response.Cookies("userInfo".Expires = DateTime.Now.AddDays(3652)
Response.Redirect("Default.aspx"
Else
lblMessage.Text = "Invalid Information!"
End If
Try posting this message in the ASP.NET forum ________________________________________________________________________
Are you trying to debug your ASP applications? See faq333-3255 for more details
yeah, that was kind of a important aspect of the problem. ASP.NET that is
try asking this in the ASP.NET forum
forum855 _________________________________________________________
for the best results to your questions: FAQ333-2924
[sub]01001111 01101110 01110000 01101110 01110100[/sub]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.