Hi,

I am getting the error (End Of Statement Expected) for the following line:

Please guide me on this issue.

Error Line:

Dim MySQL As String = "INSERT INTO Contact Us (Name, Company) VALUES ('" & TextBox1.Text & "')" "('" & TextBox4.Text & "')"

Entire Code:

<script runat="server">
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath("sociomarker.mdb") & ";"

        Dim MySQL As String = "INSERT INTO Contact Us (Name, Company) VALUES ('" & TextBox1.Text & "')" "('" & TextBox4.Text & "')"
       Dim MyConn As New OleDbConnection(strConn)
       Dim cmd As New OleDbCommand(MySQL, MyConn)
       MyConn.Open()
       cmd.ExecuteNonQuery()
       MyConn.Close()

        Response.Redirect("index.html")
    End Sub
    </script>

Thanks and Regards,

utpal

Dim MySQL As String = "INSERT INTO [Contact Us] ([Name], [Company]) VALUES ('" & TextBox1.Text & "','" & TextBox4.Text & "')"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.