question about VB.Net and Access

TBJ

Member
Joined
May 9, 2005
Messages
14
Programming Experience
1-3
Ok, basically I need to search for user and password on an access database, from VB.net in an ASP.net web form..

this is what I have so far..I need to know how to tell if the record was found or not, basically, I am new to VB.net and wanted to learn how to do stuff like this...

This is the code..


Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=d:\my documents\visual studio 2005\WebSites\WebSite4\WebReportDB.mdb"

Dim conn As OleDbConnection = New OleDbConnection(conStr)

Dim sqlStr As String = "SELECT * FROM UserTable where Onyen=" & UserName & " AND ACD=" & Password

Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlStr, conn)



conn.Open()















conn.Close()

 
I suggest you don't use an OleDbDataAdapter. If all you want to know is whether a record exists or not then you can just use an OleDbCommand and call ExecuteScalar. If you actually want the field values for the record then you should still use an OleDbCommand but call ExecuteReader instead.
 
thanks, i got it to work, basically I missed some cuotation marks, I wrote and if and it worked!

thanks anyway!
 
Back
Top