Board index » delphi » problem with "INSERT INTO .. IN .." statement using password

problem with "INSERT INTO .. IN .." statement using password


2004-02-06 04:22:22 AM
delphi223
Hi, I am trying to update an access database with another using the " Insert
into.. in.." statement, - both databases are password protected -
i'can't find the right syntax to do this in delphi
here is my delphi code:
ADOConnection1.connectionString := 'Driver={Microsoft Access Driver
(*.mdb)};DBQ=D:\dbtest\destino.mdb;password=123;';
ADOConnection1.Open;
ADOQuery1.Connection := ADOConnection1;
ADOQuery1.SQL.Text := 'INSERT INTO [productos] SELECT * FROM [productos]
IN ""[;DATABASE=D:\dbtest\origen.mdb;PWD=123];';
ADOQuery1.ExecSQL;
And i get this error: 'Parameter object is improperly defined. Inconsistent
or incomplete information was provided'.
also I have tried the same in visual basic and it is works:
strSQLprod = "INSERT INTO [productos] SELECT * FROM [productos] IN
""""[;DATABASE=D:\dbtest\origen.mdb;PWD=123];"
tanks in advance
 
 

Re:problem with "INSERT INTO .. IN .." statement using password

Quote
strSQLprod = "INSERT INTO [productos] SELECT * FROM [productos] IN
""""[;DATABASE=D:\dbtest\origen.mdb;PWD=123];"
I haven't test this ANSI-92-compliant syntax in Access, but I'd try:
INSERT INTO [productos] (<fieldlist>).....
and make sure that fields in fieldlist match the fields in the SELECT from
the other database. For instance:
INSERT INTO [productos] (<fieldlist>) SELECT (<fieldlist>) FROM....
Although my idea should work, I cannot think of why it would be necessary if
both tables have the same structure, but Access doesn't always follow
ANSI-92 rules.
mIKE
 

Re:problem with "INSERT INTO .. IN .." statement using password

i'think the problem is in the PWD parameter because it is work well if when
i remove de database password
it's works without password
ADOQuery1.SQL.Text := 'INSERT INTO [productos] SELECT * FROM [productos] IN
"D:\dbtest\origen.mdb";';
it's not working
ADOQuery1.SQL.Text := 'INSERT INTO [productos] SELECT * FROM [productos] IN
""[;DATABASE=D:\dbtest\origen.mdb;PWD=123];';
please any idea well be great, tks.
augusto
it works's without password
strSql := 'INSERT INTO [products] SELECT * FROM [products] IN
"C:\test\source.mdb"';
"Mike Ver Hagen" <XXXX@XXXXX.COM>escribi?en el mensaje
Quote
>strSQLprod = "INSERT INTO [productos] SELECT * FROM [productos] IN
>""""[;DATABASE=D:\dbtest\origen.mdb;PWD=123];"

I haven't test this ANSI-92-compliant syntax in Access, but I'd try:

INSERT INTO [productos] (<fieldlist>).....

and make sure that fields in fieldlist match the fields in the SELECT from
the other database. For instance:

INSERT INTO [productos] (<fieldlist>) SELECT (<fieldlist>) FROM....

Although my idea should work, I cannot think of why it would be necessary
if
both tables have the same structure, but Access doesn't always follow
ANSI-92 rules.

mIKE



 

Re:problem with "INSERT INTO .. IN .." statement using password

Quote
(*.mdb)};DBQ=D:\dbtest\destino.mdb;password=123;';
IN ""[;DATABASE=D:\dbtest\origen.mdb;PWD=123];';
I don't know if you've solved your problem yet, but I noticed that you use
both "password" and "PWD" in your examples.
By contrast, I note that the ConnectionString I see refers to the password
parameter as "Database Password=".
HTH. mIKE