![]() |
Obtaining information from an Access Database in VB
Hello, I am working on a Visual Basic program that has to go "behind the scenes" and confirm an Employee ID and Employee Password. The database name is EmployeeList, and is written in Access. So, how would I write this in my visual basic code? The button is a "Continue" button after entering the Employee ID and Password.
Pretty much what I'm trying to do is comparable to a log in screen. I just need to go out and verify if the user's information is correct. :/ So, any tutorials anyone knows of on how to do this, or could anyone give me some code, and explain the code? I dont just want the code, I want to understand it also. ^^; |
To connect to Access databases, you can use System.Data.OleDb. Set the Provider in the Connection to "Microsoft.Jet.OLEDB.4.0" and the Data Source to the name of the database file. Since Access supports basic SQL features, you can use a command like "Select [Employee ID] From [Employee table] Where [Employee ID] = '" & EmployeeIDTextBox.Text.Replace("'", "''") & "' And ..." (similar for password). (One would normally use Parameters, but I think that replacing quotes is enough for Access.)
However, this will only provide formal security (someone could use Access). You could ask the user the password to the database itself, then connect. You should read the .NET Framework SDK and Platform SDK sections about data access. |
| All times are GMT -5. The time now is 6:03 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC