Results 1 to 3 of 3

Thread: MS Access Problems

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    UK
    Posts
    271

    MS Access Problems

    Hi,

    I am writing a website, and I am using MS Access DBs
    DB Name:
    puzzlepirates.mdb

    tables:
    tbl_Users

    fields:
    Username
    Password

    ******************************************

    I want to retreive the value of the password, the SQL would be

    "SELECT Password FROM tbl_Users WHERE USERNAME = " txt_Username.text

    This would be a string value I know, but how do I execute it? and check it against txt_Password.txt?

    I can retreive data from another table in the DB and add it to a datagrid with the following code, but I have no idea how to get just the password?

    Code:
    Dim  MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & _
                        server.mappath("puzzlepirates.mdb"))
            Dim CommandText As String = "Select Name, Title, Rank from alchemist_guild"
    
            Dim myCommand As New OleDBCommand(CommandText, myConnection)
    
            myConnection.Open()
    
            DGAlchemist.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
            DGAlchemist.DataBind()
    any help?

    Thanks
    §tudz

    Studzworld.com - Portfolio

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    use this as a rough guide as i've not checked it
    Code:
    Dim  MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & _
                        server.mappath("puzzlepirates.mdb"))
            Dim CommandText As String = "SELECT Password FROM tbl_Users WHERE USERNAME = ' " & txt_Username.text & "' "
    
    
            Dim myCommand As New OleDBCommand(CommandText, myConnection)
            Dim myDataReader as oledbDataReader
            myConnection.Open()
            
            myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
    
            if myDataReader.read then
                 'the user can be authenticated
            end if
    hope it helps!

    Nick
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    UK
    Posts
    271
    thanks for that, but you were 5mins too late lol
    I just worked it out using oledbAdpater

    But thanks all the same,

    Maybe you can answer my other post:
    Other POST


    Thanks again
    §tudz

    Studzworld.com - Portfolio

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