Results 1 to 4 of 4

Thread: How do I turn the results of an SQL query into Strings and Integers?

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2003
    Posts
    3
    Thanks for the help, but I don't follow....

    What does ExecuteScalar mean?

    This is my code so far....

    Sub SeeIfUserExists()

    Dim ConnectionString As String = _
    "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & _
    server.mappath("database/BikeBits.mdb")

    Dim strSQL as String = ("SELECT * from tblUsers where CustomerCode = '" & txtboxCustomerCode.Text & "' and Password = '" & txtboxPassword.Text &"'")

    Dim objConnection as New OledbConnection(ConnectionString)
    Dim objCommand as New OleDbCommand(strSQL, objConnection)
    Dim objDataReader as OleDbDataReader
    try
    objConnection.open

    objDataReader = objCommand.ExecuteReader()

    if objDataReader.Read()=True Then
    'do this if record found
    Session("Username") = txtboxCustomerCode.Text
    Session("LoggedIn") = "Yes"
    Response.redirect("mainmenu.aspx")
    else
    'record doesn't exist, so do this....
    objDataReader.Close()
    objConnection.Close()
    lblError.Text="User not found!"
    end if

    objDataReader.Close()
    objConnection.Close()

    catch e as Exception
    ' con_open.text="Connection failed to open"
    ' con_close.text=e.ToString
    end try

    End Sub
    Last edited by HELLO.JPG; Dec 16th, 2003 at 04:16 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width