Very Simple Login form with MsAccess database
Using: Asp.net 3.5 / VB
After browsing a lot and not finding what I want I ask the question.
I need to make a very simple login ( no need to use the logincontrol or any remember, modify,add functionality etc.) which verifies the user and password and if correct then I set a few session variables and redirect them to Main.aspx
So I create a form with a text field (UserName) and a password field ( Password ) and a button (btnLogin).
Now Ive to open the database in the click event so I add this code to it but how do I open the database. Found that Ive to use something like Dim xx as new oledbconnection or something like that and then xx.open() but for sure Im using it the wrong way because I dont get it work.
Thanx for any help
Partial Class login2
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim Conn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("/App_Data/mydatabase.mdb") & ";Persist Security Info=False;"
Dim sql As String = "Select * from Mydatabase WHERE username=" & txtUserName.Text & "AND password=" & txtPassword.Text
'-- and now I'm stucked :-(
'-- Dim cn As New ?????????