Protected Sub Order_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Order_Button.Click Dim objConnection As SqlConnection Dim objDataCommand As SqlCommand Dim orderid, branchidsend, branchidreceive As String Dim orditemdate As String Dim sSQL As String Dim ConnectionString As String orderid = orderidtxt.Text branchidsend = Branchid_send_DropDownList.Text branchidreceive = Branchid_receive_DropDownList.Text orditemdate = orditemdatetxt.Text ConnectionString = WebConfigurationManager.ConnectionStrings("UCSConnectionString").ConnectionString objConnection = New SqlConnection(ConnectionString) objConnection.Open() sSQL = "Insert into Order (order_id, Br_id_send, Br_id_receive)" & _ "values('" & orderid & " ', ' " & branchidsend & " ',' " & branchidreceive & " ')" objDataCommand = New SqlCommand(sSQL, objConnection) objDataCommand.ExecuteNonQuery() sSQL = "Insert into Ordered_Item (OrdI_dt)" & _ "values('" & orditemdate & " ')" objDataCommand = New SqlCommand(sSQL, objConnection) objDataCommand.ExecuteNonQuery() objConnection.Close() msgLabel.Text = "Your order has been submitted successfuly, Thank you." End Sub
Protected Sub Order_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Order_Button.Click
Dim objConnection As SqlConnection
Dim objDataCommand As SqlCommand
Dim orderid, branchidsend, branchidreceive As String
Dim orditemdate As String
Dim sSQL As String
Dim ConnectionString As String
orderid = orderidtxt.Text
branchidsend = Branchid_send_DropDownList.Text
branchidreceive = Branchid_receive_DropDownList.Text
orditemdate = orditemdatetxt.Text
ConnectionString = WebConfigurationManager.ConnectionStrings("UCSConnectionString").ConnectionString
objConnection = New SqlConnection(ConnectionString)
objConnection.Open()
sSQL = "Insert into Order (order_id, Br_id_send, Br_id_receive)" & _
"values('" & orderid & " ', ' " & branchidsend & " ',' " & branchidreceive & " ')"
objDataCommand = New SqlCommand(sSQL, objConnection)
objDataCommand.ExecuteNonQuery()
sSQL = "Insert into Ordered_Item (OrdI_dt)" & _
"values('" & orditemdate & " ')"
objConnection.Close()
msgLabel.Text = "Your order has been submitted successfuly, Thank you."
End Sub