ODBC error: Operation must use an updateable query

vbhargav80

New member
Joined
Feb 27, 2005
Messages
2
Programming Experience
1-3
Hi,
i am connecting to a 'Paradox' data source using a System DSN. The connection is established successfully. I then use a create table query to ad a new table to the database.

After this i used an insert query to add a record to the table. It all works fine until here. But after this point if i try and insert any more records into the table i get the error "Operation must use an updateable query".

I'm using the ODBCConnection and ODBCCommand object. Following is the code


_conn = New OdbcConnection()

_adapter =
New OdbcDataAdapter()

_strConnStr = "DSN=bmwcards;"

_strQuery = "CREATE TABLE " + _saveDial.FileName & _

" ( FIRSTNAME CHAR(30), " & _

"LASTNAME CHAR(30), " & _

"CARDNUM CHAR(12), " & _

"MODEL CHAR(10), " & _

"REGO CHAR(10), " & _

"STARTDATE CHAR(10), " & _

"ENDDATE CHAR(10) );"

_conn.ConnectionString = _strConnStr

_conn.Open()

_command =
New OdbcCommand(_strQuery)

_command.Connection = _conn

If (File.Exists(_saveDial.FileName)) Then

File.Delete(_saveDial.FileName)

End If



_command.ExecuteNonQuery()

'For _ind = 0 To 10

_command.CommandText = "insert into " & _saveDial.FileName & _

" (FIRSTNAME, LASTNAME) values ('bheja','fry')"

_command.ExecuteNonQuery()

_command.CommandText = "insert into " & _saveDial.FileName & _

" (FIRSTNAME, LASTNAME) values ('val1','val2')"

Try

_command.ExecuteNonQuery()

Catch e As Exception

MsgBox(e.ToString)

MsgBox(_command.CommandText)

End Try

 
Top Bottom