Ayesha balooshi

Ayesha balooshi

  • NA
  • 18
  • 28.2k

Help in inserting data into a table

May 10 2010 10:41 AM
good day,
I have created a manual form with a text box and drop down list

using the code below
 

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

 

 
however, the highlighted part is the error i am getting after clicking the button ...


Answers (2)