Dim CusID As String = txtCusID.Text.Trim
Dim CusName As String = txtCusName.Text.Trim
Dim CusLname As String = txtCusLname.Text.Trim
Dim CusAdd As String = txtCusAdd.Text.Trim
Dim CusMobile As String = txtCusMobile.Text.Trim
Dim CusType As String = cbbCusType.Text
Dim EmpID As String = txtEmpID.Text.Trim
Dim EmpName As String = txtEmpName.Text.Trim
Dim EmpSurname As String = txtEmpSurname.Text.Trim
Dim EmpClass As String = cbbClass.Text
Dim EmpMobile As String = txtEmpMobile.Text.Trim
Dim WDetail As String = txtWDetail.Text.Trim
Dim Wstatus As String = "ปกติ"
Dim WArea As String = cbbArea.Text
Dim WOrder As String = cbbOrder.Text
If cbbOrder.SelectedItem = "ติดตั้ง,เดินสายภายใน" Then
WOrder = "E1"
ElseIf cbbOrder.SelectedItem = "ตรวจสอบ,ซ่อมแซมบริการอินเตอร์เน็ต" Then
WOrder = "E2"
ElseIf cbbOrder.SelectedItem = "ตรวจสอบ,ซ่อมแซมบริการโทรศัพท์" Then
WOrder = "E3"
End If
If cbbArea.SelectedItem = "เขตดินแดง" Then
WArea = "W001"
ElseIf cbbArea.SelectedItem = "เขตพญาไท" Then
WArea = "W002"
ElseIf cbbArea.SelectedItem = "เขตราชเทวี" Then
WArea = "W003"
ElseIf cbbArea.SelectedItem = "เขตสามเสน" Then
WArea = "W004"
End If
Select Case actionFlag
Case "ADD"
AutoGenearteMember_id()
Dim WorkID As String = txtWorkID.Text.Trim
Cnnstring = "Data Source=CHOKO-PC;Initial Catalog=DBPMs;Persist Security Info=True;User Id=pms;Password=project"
'MessageBox.Show(Sqlcmd)
Dim cn As New System.Data.SqlClient.SqlConnection(Cnnstring)
Dim cm As New SqlCommand(sqlcmd, cn)
Dim dr As SqlDataReader
cn.Open()
dr = cm.ExecuteReader
cn.Close()
Private Sub txtCusID_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCusID.KeyDown
If txtCusID.Text <> "" Then
If (e.KeyCode = Keys.Enter) Then
Dim sqlCus As String = ""
sqlCus = "SELECT * FROM tbCus WHERE CusID = '" & txtCusID.Text & " ' order by CusID"
Cnnstring = "Data Source=CHOKO-PC;Initial Catalog=DBPMs;Persist Security Info=True;User Id=pms;Password=project"
With Cnn 'เริ่มต้นเชื่อมฐานข้อมูล
If .State = ConnectionState.Open Then .Close()
.ConnectionString = Cnnstring
.Open() 'เชื่อมต่อฐานข้อมูล
End With
If IsFind = True Then
ds.Tables("tbCus").Clear()
End If
da.SelectCommand.CommandText = sqlCus
da.Fill(ds, "tbCus")
If ds.Tables("tbCus").Rows.Count <> 0 Then
IsFind = True
ClearForm(GroupBox2)
txtCusID.Focus()
txtCusID.SelectAll()
End If
End If
End If
End Sub
Private Sub txtEmpID_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtEmpID.KeyDown
If txtEmpID.Text <> "" Then
If (e.KeyCode = Keys.Enter) Then
Dim sqlEmp As String = ""
sqlEmp = "SELECT * FROM tbEMP WHERE EmpID = '" & txtEmpID.Text & " ' order by EmpID"
Cnnstring = "Data Source=CHOKO-PC;Initial Catalog=DBPMs;Persist Security Info=True;User Id=pms;Password=project"
With Cnn 'เริ่มต้นเชื่อมฐานข้อมูล
If .State = ConnectionState.Open Then .Close()
.ConnectionString = Cnnstring
.Open() 'เชื่อมต่อฐานข้อมูล
End With
If IsFind2 = True Then
ds.Tables("tbEMP").Clear()
End If
da.SelectCommand.CommandText = sqlEmp
da.Fill(ds, "tbEMP")
If ds.Tables("tbEMP").Rows.Count <> 0 Then
IsFind2 = True