Hello,
I want to check the username & password of the user with the already stored database and then login. Iam using asp.net(vb) with sql server as database. Please help ME
Imports System.Data.SqlClient
Imports System.Data
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Dim con As New SqlConnection("server=localhost;database=reg1;integrated security=yes;")
Dim ds As dataset
Dim da As SqlDataAdapter
Dim dr As SqlDataReader
Dim MyDataGrid As New DataGrid()
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
con.Open()
Session.Add("Username", TextBox1.Text)
Session.Add("Password", TextBox2.Text)
Response.Redirect("default.aspx")
'Dim a, b As String
'a = TextBox1.Text
'b = TextBox2.Text
If a = "&Username" And b = "&Password" Then
da = New SqlDataAdapter("select * from retable", con)
ds = New DataSet
da.Fill(ds, "retable")
MyDataGrid.DataSource = ds.Tables("retable").DefaultView
MyDataGrid.DataBind()
Else
Label3.Text = "pls enter correct pwd"
End If
con.Close()
by following this code i get logged in but it didn't check with database