none
cant update query RRS feed

  • Question

  • [code]
    Dim SQL As String
        Dim rs As Data.SqlClient.SqlDataReader
        Dim SQLConnection As New SqlClient.SqlConnection("data source= ;Database=;uid=;pwd=;Integrated Security=")

    SQL = "INSERT into Table values = ('" & Trim((Left(Me.Available.SelectedItem, 5))) & "')"
            Dim objCmd As New SqlClient.SqlCommand(SQL, SQLConnection)
            objCmd.ExecuteNonQuery()
    [/code]

    why can't i use these lines of code. It doesn't update. Everytime when it gets to objcmd.execute it tells me "Line 1: Incorrect syntax near '='.'

    if i put the msgbox in i got insert into table values = ('12')

    plz help guys. Thank you very much

    Tuesday, July 24, 2007 9:27 PM

All replies

  • You need to remove the equal sign.  It should look like this:

     

    Code Snippet

    SQL = "INSERT into Table values('" & Trim((Left(Me.Available.SelectedItem, 5))) & "')"

     

    Tuesday, July 24, 2007 11:15 PM
  • general syntax for insert command is

    insert into <tablename> values(val1,val2,...)
    I think u got it
    Thank u

    Baba

    Wednesday, July 25, 2007 11:00 AM