0

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

Edited by __avd: Added [code] tags.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by __avd
0
Dim MySQL As String = "INSERT INTO [Contact Us] ([Name], [Company]) VALUES ('" & TextBox1.Text & "','" & TextBox4.Text & "')"
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.