0% found this document useful (0 votes)
6 views4 pages

4444

Uploaded by

mmhmdlysam14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

4444

Uploaded by

mmhmdlysam14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Imports System.Data.

SqlClient
Partial Class uu_Default
Inherits System.Web.UI.Page
Public con As New SqlConnection("Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=eee;Data Source=DESKTOP-PUKF9K1\SQLEXPRESS")

Dim cmd As New SqlCommand("select * from ee1", con)


Dim da As New SqlDataAdapter(cmd)
Dim dt As New Data.DataTable
Protected Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox2.TextChanged
End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
da = New SqlDataAdapter("select * from ee1 where id='" &
Trim(TextBox1.Text) & "'and st_u='" & Trim(TextBox2.Text) & "'", con)

If dt.Rows.Count > 0 Then


MsgBox("�����")
Response.Redirect("Default3.aspx")
Else

MsgBox("���� ��� �� ��� �������� �� ���� ������")

End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
dt.Clear()
da.Fill(dt)
End Sub
End Class
///////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
Imports System.Data.SqlClient
Partial Class uu_Default4
Inherits System.Web.UI.Page
Public con As New SqlConnection("Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=eee;Data Source=DESKTOP-PUKF9K1\SQLEXPRESS")

Dim cmd As New SqlCommand("select * from ee2", con)


Dim da As New SqlDataAdapter(cmd)
Dim dt As New Data.DataTable
Protected Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox2.TextChanged
End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
If con.State = Data.ConnectionState.Closed Then con.Open()
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("������ ����� ������")
Exit Sub
End If
Dim cmd As New SqlCommand("insert into ee2 values(" & Val(TextBox1.Text) &
",'" & Trim(TextBox2.Text) & "','" & Trim(TextBox3.Text) & "','" &
Trim(TextBox4.Text) & "','" & Trim(TextBox5.Text) & "','" & Trim(TextBox6.Text) &
"','" & Trim(TextBox7.Text) & "')", con)
cmd.ExecuteNonQuery()
MsgBox("�� �����")
End Sub

Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
If con.State = Data.ConnectionState.Closed Then con.Open()
Dim cmd As New SqlCommand("update ee1 set id='" & Trim(TextBox2.Text) &
"',sst_uu='" & Trim(TextBox3.Text) & "'s_tu='" & Trim(TextBox4.Text) & "',idd_s='"
& Trim(TextBox5.Text) & "',st_mm='" & Trim(TextBox6.Text) & "',stu_uu='" &
Trim(TextBox7.Text) & "',i_ds='" & Val(TextBox1.Text) & "", con)
cmd.ExecuteNonQuery()
MsgBox("�� ������� �����")
End Sub

Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles


Button3.Click
If con.State = Data.ConnectionState.Closed Then con.Open()

Dim b As Boolean = False


Dim cmd As New SqlCommand("select * from ee2 where id=" &
Val(TextBox1.Text) & "", con)
Dim dr As SqlDataReader
dr = cmd.ExecuteReader
While dr.Read
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
TextBox4.Text = dr(3)
TextBox5.Text = dr(4)
TextBox6.Text = dr(5)
TextBox7.Text = dr(6)
b = True
End While
dr.Close()
If b = False Then
MsgBox("�������� ��� ������")
End If
End Sub

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

End Sub

Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles


Button4.Click
If MsgBox("�� ���� �����", MsgBoxStyle.YesNo + MsgBoxStyle.Question) =
MsgBoxResult.No Then Exit Sub
If con.State = Data.ConnectionState.Closed Then con.Open()
Dim cmd As New SqlCommand("delete from ee2 where id=" & Val(TextBox1.Text)
& ",'" & Trim(TextBox2.Text) & "','" & Trim(TextBox3.Text) & "','" &
Trim(TextBox4.Text) & "','" & Trim(TextBox5.Text) & "','" & Trim(TextBox6.Text) &
"','" & Trim(TextBox7.Text) & "')", con)
cmd.ExecuteNonQuery()
MsgBox("�� ����� �����")

End Sub
End Class
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////
Imports System.Data.SqlClient
Partial Class uu_Default3
Inherits System.Web.UI.Page
Public con As New SqlConnection("Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=eee;Data Source=DESKTOP-PUKF9K1\SQLEXPRESS")

Dim cmd As New SqlCommand("select * from ee1", con)


Dim da As New SqlDataAdapter(cmd)
Dim dt As New Data.DataTable
Protected Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox2.TextChanged
End Sub

Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
If con.State = Data.ConnectionState.Closed Then con.Open()
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("������ ����� ������")
Exit Sub
End If
Dim cmd As New SqlCommand("insert into ee1 values(" & Val(TextBox1.Text) &
",'" & Trim(TextBox2.Text) & "')", con)
cmd.ExecuteNonQuery()
MsgBox("�� �����")
End Sub

Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles


Button3.Click
If con.State = Data.ConnectionState.Closed Then con.Open()
Dim m As Boolean = False
If TextBox1.Text <> "" Then
Dim Cmd As New SqlCommand("select*from ee1 where id=(" &
Val(TextBox1.Text) & ")", con)
Dim dr As SqlDataReader
dr = Cmd.ExecuteReader
While dr.Read
TextBox2.Text = dr("st_u")
m = True
End While
Else
MsgBox("������ ����� ��� ������ ���� ")
End If
If m = False Then
MsgBox(" �������� ��� ������")
End If
End Sub

Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles


Button4.Click
If con.State = Data.ConnectionState.Closed Then con.Open()
Dim cmd As New SqlCommand("update ee1 set st_u='" & Trim(TextBox2.Text) &
"'where id=" & Val(TextBox1.Text) & "", con)
cmd.ExecuteNonQuery()
MsgBox("�� ������� �����")
End Sub

Protected Sub Button5_Click(sender As Object, e As EventArgs) Handles


Button5.Click
If con.State = Data.ConnectionState.Closed Then con.Open()
If MsgBox("�� ��� ����� �� ��� ��������", MsgBoxStyle.YesNo +
MsgBoxStyle.Question) = MsgBoxResult.No Then Exit Sub
Dim cmd As New SqlCommand("delete from ee1 where id=" & Val(TextBox1.Text),
con)
cmd.ExecuteNonQuery()
MsgBox("�� ����� �����")
End Sub
End Class

You might also like