Deleting records with VB
Posted in 1999
Topics: Connectivity: ODBC / JDBC / .NET, Security, Permissions & Auditing
Hello, I like to delete all the records from the table 'table_1' in my informix database 'dbs_1' I tried this: Private cmmtabel As New ADODB.Command Private strConnect As String MsgBox "table_1 will be cleared !" strConnect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=informix;Password=informix;Data Source=odbc_conn" With cmmtabel .ActiveConnection = strConnect .CommandType = adCmdUnknown .CommandText = "DELETE * FROM table_1;" .Execute End With This generates an error in the Intersolv driver, when I use 'SELECT' instead of 'DELETE' there is no error. May I use the DELETE statement ?? What statements can I use ?? odbc_conn is a working ODBC-connection using the 'Intersolv 3.01 32-bit informix' driver
Just drop the asterisk - '*'. The delete statement operates on rows not columns so the '*' is a syntax error. Make that statement in quotes: "DELETE FROM table_1;" And all will be well. Art S. Kagel Jan Giezen wrote: > > Hello, > > I like to delete all the records from the table 'table_1' in my informix > database 'dbs_1' > > I tried this: > > Private cmmtabel As New ADODB.Command > Private strConnect As String > > MsgBox "table_1 will be cleared !" > > strConnect = "Provider=MSDASQL.1;Persist Security Info=False;User > ID=informix;Password=informix;Data Source=odbc_conn" > > With cmmtabel > .ActiveConnection = strConnect > .CommandType = adCmdUnknown > .CommandText = "DELETE * FROM table_1;" > .Execute > End With > > This generates an error in the Intersolv driver, when I use 'SELECT' instead > of 'DELETE' there is no error. > May I use the DELETE statement ?? > What statements can I use ?? > > odbc_conn is a working ODBC-connection using the 'Intersolv 3.01 32-bit > informix' driver