01.
Sub
myGridView_RowCommand(source
As
Object
, e
As
GridViewCommandEventArgs)
02.
If
e.CommandName =
"Add"
Then
03.
04.
Dim
txtPartID
As
TextBox =
CType
(myGridView.FooterRow.FindControl(
"txtAddPartID"
), TextBox)
05.
06.
Dim
txtPartNo
As
TextBox =
CType
(myGridView.FooterRow.FindControl(
"txtAddPartNo"
), TextBox)
07.
08.
Dim
txtPartName
As
TextBox =
CType
(myGridView.FooterRow.FindControl(
"txtAddPartName"
), TextBox)
09.
10.
Dim
txtPartModel
As
TextBox =
CType
(myGridView.FooterRow.FindControl(
"txtAddPartModel"
), TextBox)
11.
12.
Dim
txtCustomerPrice
As
TextBox =
CType
(myGridView.FooterRow.FindControl(
"txtAddCustomerPrice"
), TextBox)
13.
14.
Dim
txtPartSub
As
TextBox =
CType
(myGridView.FooterRow.FindControl(
"txtAddPartSub"
), TextBox)
15.
16.
strSQL =
"INSERT INTO [PLASMA[ ([PartID], [PartNo], [PartName], [PartModel], [CustomerPrice], [PartSub]) VALUES (@PartID, @PartNo, @PartName, @PartModel, @CustomerPrice, @PartSub)"
17.
objCmd =
New
SqlCommand(strSQL, objConn)
18.
objCmd.Parameters.AddWithValue(
"@PartID"
, txtPartID.Text)
19.
objCmd.Parameters.AddWithValue(
"@PartNo"
, txtPartNo.Text)
20.
objCmd.Parameters.AddWithValue(
"@PartName"
, txtPartName.Text)
21.
objCmd.Parameters.AddWithValue(
"@PartModel"
, txtPartModel.Text)
22.
objCmd.Parameters.AddWithValue(
"@CustomerPrice"
, txtCustomerPrice.Text)
23.
objCmd.Parameters.AddWithValue(
"@PartSub"
, txtPartSub.Text)
24.
objCmd.ExecuteNonQuery()
25.
26.
BindData()
27.
End
If
28.
End
Sub