-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevice.aspx.vb
73 lines (57 loc) · 3.06 KB
/
device.aspx.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Imports System.Configuration
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("usr_name") = Nothing Then
Response.Redirect("default.aspx")
Else
End If
End Sub
Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.Label1.Visible = True
If Me.txtdvname.Text = "" Or Me.txtdvtype.Text = "" Or Me.txtdvmodel.Text = "" Then
Me.Label1.Text = "íÌÈ ÇÏÎÇá ÇáÈíÇäÇÇÊ ÇáÖÑæÑíÉ"
Else
' åÐÇ ÇáßæÏ íÞæã ÈÍÝÙ ÇáÈíÇäÇÊ
' íÊã æÕá ÇáÇÊÕÇá ÈÇáßä
Dim con As New OleDbConnection
con.ConnectionString = ConfigurationManager.AppSettings("con")
con.Open()
Dim ds As New Data.DataSet
'íÊã ÌáÈ áÈíÇäÇÊ ãä ÇáÌÏæá
Dim dp As New OleDbDataAdapter("SELECT device.dvc_id, device.dvc_type, device.dv_model, device.dvc_size, device.dvc_capacity, device.dvc_speed, device.dvc_product, device.dvc_price, device.cmp_no FROM company INNER JOIN device ON company.cmp_no = device.cmp_no", con)
' íÊã ÊÚÈÆÉ ÇáÏÇÊÇ ÓíÊ ÈÇáÌÏæá
dp.Fill(ds, "device")
Dim s As New OleDbCommand
s.Connection = con
s.CommandText = "insert into device ( dvc_id, dvc_type, dv_model, dvc_size, dvc_capacity, dvc_speed, dvc_product, dvc_price, cmp_no) values (" & Me.txtdvname.Text & ",'" & Me.txtdvtype.Text & "','" & Me.txtdvmodel.Text & "','" & Me.txtdvsize.Text & "','" & Me.txtdvopacity.Text & "','" & Me.txtdvspeed.Text & "','" & Me.txtdvother.Text & "','" & Me.txtdvcost.Text & "'," & Session("usr_name") & ")"
'íÊã ÊäÝíÐ ÌãáÉ ÇáÇÓ ßíæ Çá
s.ExecuteNonQuery()
con.Close()
Me.Label1.Text = "Êã ÇáÍÝÙ"
End If
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Label1.Visible = True
If Me.txtdvname.Text = "" Or Me.txtdvtype.Text = "" Or Me.txtdvmodel.Text = "" Then
Me.Label1.Text = "íÌÈ ÇÏÎÇá ÇáÈíÇäÇÇÊ ÇáÖÑæÑíÉ"
Else
Dim con As New OleDbConnection
Dim ds As New Data.DataSet
con.ConnectionString = ConfigurationManager.AppSettings("con")
con.Open()
Dim sql As String = "select * from device"
Dim da As New OleDbDataAdapter(sql, con)
da.Fill(ds, "device")
Dim aa As New OleDbCommand
aa.Connection = con
aa.CommandText = "delete from device where dvc_id=" & Me.txtdvname.Text & " and cmp_no=" & Session("usr_name") & ""
aa.ExecuteNonQuery()
con.Close()
Me.Label1.Text = "Êã ÇáÍÐÝ ÈäÌÇÍ"
End If
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub
End Class