INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

INSERT INTO -> problem with copying data

INSERT INTO -> problem with copying data

(OP)
Hi,

I have problem with copying data between two MS Access databases.

I have:
a) DataBase1 that has Table1 that has field Model
b) DataBase2 that has Table2 that has field Model

Both databases are protected. Password is: <>something[]

I try to copy data by using ADOCommand, so I have something like this:

with ADOCommand1 do
begin
Close;
ConnectionString := ... connection_string_to_DataBase1;

CommandText := 'INSERT INTO [Table1] SELECT Model FROM [;DATABASE=' + path_to_DataBase2 + ';PWD=<>something[]].[Table2];';

Execute;
Close;
end;

When I try execute this, I get some error with message: wrong defined parameter ...

Anyone knows what I'm doing wrong?
Thx for help.



RE: INSERT INTO -> problem with copying data

Hi mishmash,

the correct syntax would be:

CODE

var SQL : String;
 ... 

 SQL := 'INSERT INTO [Table1] SELECT * FROM [MS Access;DATABASE=%s;Jet OLEDB:Database Password=%s;].[Table2]';
 CommandText := Format(SQL, [Database_Path, DatabasePassword]);
 ... 

if this still doesn't work, then it might be that the square brackets in the password are giving problems.
so try to change the db password to not include square brackets and see if that helps...

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!

RE: INSERT INTO -> problem with copying data

(OP)
Thanks.
I will remove brackets, it will be the best options smile

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close