|
-
Dec 2nd, 2003, 06:03 AM
#1
Thread Starter
Hyperactive Member
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
-
Dec 2nd, 2003, 09:09 AM
#2
Fanatic Member
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
-
Dec 2nd, 2003, 10:20 AM
#3
Thread Starter
Hyperactive Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|