Results 1 to 2 of 2

Thread: Expected query name after execute

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2003
    Location
    Belgium
    Posts
    18

    Expected query name after execute

    I want to make a querie wich alters my table like this:

    Dim cmd As New OleDb.OleDbCommand

    cmd.CommandText = "ALTER TABLE Crawford_nl ADD COLUMN [Index] COUNTER PRIMARY KEY"

    cmd.CommandType = CommandType.StoredProcedure
    cmd.Connection = Me.OleDbConnection1 '
    Try
    cmd.ExecuteNonQuery()
    Catch ex As Exception
    MsgBox(Err.Number & ":" & Err.Description)
    End Try

    I get the error message:
    "Expected query name after EXECUTE"

    When I do the same, but change 'OleDb' to 'Odbc', it works, but I want to do it with OleDb.

    Can anyone help me?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    this code works:

    SqlStr = "Delete from SystemValues"
    Dim SystemValues As New OleDbCommand(SqlStr, myConnection)
    SystemValues.Connection.Open()
    SystemValues.ExecuteNonQuery()
    myConnection.Close()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width