01.
Dim
myCommand
As
SqlCommand = Conn.CreateCommand()
02.
Dim
sqlSave
As
String
03.
If
CBool
(MessageBox.Show(
"บันทึกใช่หรือไม่ !!!"
,
"ผลการทำงาน"
, MessageBoxButtons.YesNo, MessageBoxIcon.Information) = DialogResult.Yes)
Then
04.
05.
sqlSave =
"INSERT INTO [Passport] ([Passport_No],[Name_in_Thai],[Type],[Country_ID],[DateOfBirth],[PlaceOfBirth],[DateOfIssue],[DateOfExpiry],[Authority],[L_Passport_No],[Passenger_ID]) VALUES (@Passport_No,@Name_in_Thai,@Type,@Country_ID,@DateOfBirth,@PlaceOfBirth,@DateOfIssue,@DateOfExpiry,@Authority,@L_Passport_No,@Passenger_ID)"
06.
myCommand =
New
SqlCommand(sqlSave, Conn)
07.
myCommand.Parameters.AddWithValue(
"@Passport_No"
,
Me
.tbxPassport_No.Text)
08.
myCommand.Parameters.AddWithValue(
"@Name_in_Thai"
,
Me
.tbxName.Text)
09.
myCommand.Parameters.AddWithValue(
"@Type"
,
Me
.tbxType.Text)
10.
myCommand.Parameters.AddWithValue(
"@Country_ID"
,
Me
.cbCountry.Text)
11.
myCommand.Parameters.AddWithValue(
"@DateOfBirth"
, dtDOB.Text)
12.
myCommand.Parameters.AddWithValue(
"@PlaceOfBirth"
,
Me
.tbxPOB.Text)
13.
myCommand.Parameters.AddWithValue(
"@DateOfIssue"
, dtIssueDate.Text)
14.
myCommand.Parameters.AddWithValue(
"@DateOfExpiry"
, dtExpiryDate.Text)
15.
myCommand.Parameters.AddWithValue(
"@Authority"
,
Me
.tbxAuthority.Text)
16.
myCommand.Parameters.AddWithValue(
"@L_Passport_No"
,
Me
.tbxLastPassport.Text)
17.
myCommand.Parameters.AddWithValue(
"@Passenger_ID"
,
Me
.tbxPassengerID.Text)
18.
19.
With
myCommand
20.
.CommandType = CommandType.Text
21.
.CommandText = sqlSave
22.
.Connection = Conn
23.
.ExecuteNonQuery()
24.
25.
End
With
26.
27.
MessageBox.Show(
"บันทึกลงฐานข้อมูล เรียบร้อยแล้ว !!!"
,
"ผลการทำงาน"
, MessageBoxButtons.OK, MessageBoxIcon.Information)
28.
End
If