The command verbs supported by ODBC are not as rich as those available from OleDB.
If OleDB works, I would use OleDB.
If it is an issue of connection strings, check out www.connectionstrings.com.
What SQL statement is contained in AgregarCliente?
Remember that you can not include VBA functions in SQL statements that will be executed outside of Access.
"Jaime Lucci" <jaimelucci[ at ]hotmail.com> wrote in message news:uXsU40JyGHA.2220[ at ]TK2MSFTNGP02.phx.gbl...
[Quoted Text] > Hi everyne > > I`m trying to run aan acces query with parameters from VB 2005. If I do it > with OleDB components I have no problems, but I need to do that with ODBC, > but I get this error: > > ERROR [42000] [Microsoft][ODBC Microsoft Access Driver] Invalid SQL > statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or > 'UPDATE'. > > The code is the following: > > Dim CnnODBC As Odbc.OdbcConnection > Dim cmd As Odbc.OdbcCommand > 'Connect to database > CnnODBC = New Odbc.OdbcConnection("DSN=asd") > CnnODBC.Open() > 'The ms access query > cmd = New Odbc.OdbcCommand("AgregarCliente", CnnODBC) > cmd.CommandType = CommandType.StoredProcedure > 'Parameters > With cmd.Parameters > .Add("paramRazonSocial", txtRazonSocial.Text) > .Add("paramDomicilio", txtDomicilio.Text) > .Add("paramNumCliente", txtNumCliente.Text) > End With > 'Execution > cmd.ExecuteNonQuery() > 'Disconnect > CnnODBC.Close() > > The error occurs in the execute line. Can you help me? > > Thanks > > Jaime Lucci. > > >
|