Imports System
Imports System.Data
Imports System.Data.Common
Imports System.Data.SqlClient
Partial Class order_status
Inherits System.Web.UI.Page
Protected Sub login_b_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles login_b.Click
Dim flg As Integer
flg = 1
Dim cnn As New SqlConnection
Dim cmd As New SqlCommand
Dim reader As SqlDataReader
Dim username_box As String
Dim password_box As String
username_box = username_txt.Text
password_box = password_txt.Text
cnn.ConnectionString = "Data Source=sunboy\SQLEXPRESS;Initial Catalog=amlak;Integrated Security=True"
cmd.CommandText = "select * from sefaresh "
cnn.Open()
cmd.Connection = cnn
reader = cmd.ExecuteReader
reader.Read()
Do While reader.Read
If reader("username").ToString = username_box And reader("password").ToString = password_box Then
flg = 2
End If
Loop
If flg = 2 Then
Response.Redirect("search.aspx")
Else
Wrong_L.Visible = True
End If
cnn.Close()
End Sub
End Class
مرسي از لطفتون
ممنون ميشم كمكم كنيد