Home All Groups Group Topic Archive Search About

Copying from one db into another

Author
12 Jan 2007 12:36 PM
John
Hi

I am trying to copy data from one db into another. Thanks for everyone who
suggested ways to do that. After some more research I have come up with the
below simple looking way. My question in, is it supposed to work this way
and will it work?

LocalConn.Open()

Dim DBCommand As New System.Data.OleDb.OleDbCommand("SELECT id, name, date
INTO (localtable) FROM remotetable  IN [Data Source=<ip address>;Initial
Catalog=&quot;RemoteDB&quot;;Persist Security Info=True;User
ID=&quot;username&quot;;Password=password];", LocalConn)

DBCommand.ExecuteNonQuery()

LocalConn.Close()

The remote db is a sql server.

Many Thanks

Regards

Author
12 Jan 2007 1:11 PM
Stephany Young
What happened when you tried it?


Show quote
"John" <John@nospam.infovis.co.uk> wrote in message
news:efsw8YkNHHA.992@TK2MSFTNGP06.phx.gbl...
> Hi
>
> I am trying to copy data from one db into another. Thanks for everyone who
> suggested ways to do that. After some more research I have come up with
> the below simple looking way. My question in, is it supposed to work this
> way and will it work?
>
> LocalConn.Open()
>
> Dim DBCommand As New System.Data.OleDb.OleDbCommand("SELECT id, name, date
> INTO (localtable) FROM remotetable  IN [Data Source=<ip address>;Initial
> Catalog=&quot;RemoteDB&quot;;Persist Security Info=True;User
> ID=&quot;username&quot;;Password=password];", LocalConn)
>
> DBCommand.ExecuteNonQuery()
>
> LocalConn.Close()
>
> The remote db is a sql server.
>
> Many Thanks
>
> Regards
>
>
>
>
Author
12 Jan 2007 1:18 PM
John
Message="The SELECT statement includes a reserved word or an argument name
that is misspelled or missing, or the punctuation is incorrect."

Source="Microsoft JET Database Engine"

I am new to this syntax (when two dbs are involved) so not sure which
parameter is invalid. LocalConn is to a local access db.

Any help would be appreciated.

Thanks

Regards

Show quote
"Stephany Young" <noone@localhost> wrote in message
news:u33m5skNHHA.2468@TK2MSFTNGP06.phx.gbl...
> What happened when you tried it?
>
>
> "John" <John@nospam.infovis.co.uk> wrote in message
> news:efsw8YkNHHA.992@TK2MSFTNGP06.phx.gbl...
>> Hi
>>
>> I am trying to copy data from one db into another. Thanks for everyone
>> who suggested ways to do that. After some more research I have come up
>> with the below simple looking way. My question in, is it supposed to work
>> this way and will it work?
>>
>> LocalConn.Open()
>>
>> Dim DBCommand As New System.Data.OleDb.OleDbCommand("SELECT id, name,
>> date INTO (localtable) FROM remotetable  IN [Data Source=<ip
>> address>;Initial Catalog=&quot;RemoteDB&quot;;Persist Security
>> Info=True;User ID=&quot;username&quot;;Password=password];", LocalConn)
>>
>> DBCommand.ExecuteNonQuery()
>>
>> LocalConn.Close()
>>
>> The remote db is a sql server.
>>
>> Many Thanks
>>
>> Regards
>>
>>
>>
>>
>
>
Author
12 Jan 2007 1:25 PM
Stephany Young
Try Select id, name, [date] ...

Date is a reserved word in Jet and to use it as a column name in a SQL
statement you have to decorate it.


Show quote
"John" <John@nospam.infovis.co.uk> wrote in message
news:uVV5twkNHHA.4376@TK2MSFTNGP03.phx.gbl...
> Message="The SELECT statement includes a reserved word or an argument name
> that is misspelled or missing, or the punctuation is incorrect."
>
> Source="Microsoft JET Database Engine"
>
> I am new to this syntax (when two dbs are involved) so not sure which
> parameter is invalid. LocalConn is to a local access db.
>
> Any help would be appreciated.
>
> Thanks
>
> Regards
>
> "Stephany Young" <noone@localhost> wrote in message
> news:u33m5skNHHA.2468@TK2MSFTNGP06.phx.gbl...
>> What happened when you tried it?
>>
>>
>> "John" <John@nospam.infovis.co.uk> wrote in message
>> news:efsw8YkNHHA.992@TK2MSFTNGP06.phx.gbl...
>>> Hi
>>>
>>> I am trying to copy data from one db into another. Thanks for everyone
>>> who suggested ways to do that. After some more research I have come up
>>> with the below simple looking way. My question in, is it supposed to
>>> work this way and will it work?
>>>
>>> LocalConn.Open()
>>>
>>> Dim DBCommand As New System.Data.OleDb.OleDbCommand("SELECT id, name,
>>> date INTO (localtable) FROM remotetable  IN [Data Source=<ip
>>> address>;Initial Catalog=&quot;RemoteDB&quot;;Persist Security
>>> Info=True;User ID=&quot;username&quot;;Password=password];", LocalConn)
>>>
>>> DBCommand.ExecuteNonQuery()
>>>
>>> LocalConn.Close()
>>>
>>> The remote db is a sql server.
>>>
>>> Many Thanks
>>>
>>> Regards
>>>
>>>
>>>
>>>
>>
>>
>
>
Author
12 Jan 2007 1:32 PM
John
Thanks. Still says the same things. ErrorCode=-2147217900 is also the same.

Regards

Show quote
"Stephany Young" <noone@localhost> wrote in message
news:elEhs0kNHHA.4152@TK2MSFTNGP06.phx.gbl...
> Try Select id, name, [date] ...
>
> Date is a reserved word in Jet and to use it as a column name in a SQL
> statement you have to decorate it.
>
>
> "John" <John@nospam.infovis.co.uk> wrote in message
> news:uVV5twkNHHA.4376@TK2MSFTNGP03.phx.gbl...
>> Message="The SELECT statement includes a reserved word or an argument
>> name that is misspelled or missing, or the punctuation is incorrect."
>>
>> Source="Microsoft JET Database Engine"
>>
>> I am new to this syntax (when two dbs are involved) so not sure which
>> parameter is invalid. LocalConn is to a local access db.
>>
>> Any help would be appreciated.
>>
>> Thanks
>>
>> Regards
>>
>> "Stephany Young" <noone@localhost> wrote in message
>> news:u33m5skNHHA.2468@TK2MSFTNGP06.phx.gbl...
>>> What happened when you tried it?
>>>
>>>
>>> "John" <John@nospam.infovis.co.uk> wrote in message
>>> news:efsw8YkNHHA.992@TK2MSFTNGP06.phx.gbl...
>>>> Hi
>>>>
>>>> I am trying to copy data from one db into another. Thanks for everyone
>>>> who suggested ways to do that. After some more research I have come up
>>>> with the below simple looking way. My question in, is it supposed to
>>>> work this way and will it work?
>>>>
>>>> LocalConn.Open()
>>>>
>>>> Dim DBCommand As New System.Data.OleDb.OleDbCommand("SELECT id, name,
>>>> date INTO (localtable) FROM remotetable  IN [Data Source=<ip
>>>> address>;Initial Catalog=&quot;RemoteDB&quot;;Persist Security
>>>> Info=True;User ID=&quot;username&quot;;Password=password];", LocalConn)
>>>>
>>>> DBCommand.ExecuteNonQuery()
>>>>
>>>> LocalConn.Close()
>>>>
>>>> The remote db is a sql server.
>>>>
>>>> Many Thanks
>>>>
>>>> Regards
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
12 Jan 2007 6:20 PM
Paul Clement
On Fri, 12 Jan 2007 13:32:26 -0000, "John" <John@nospam.infovis.co.uk> wrote:

¤ Thanks. Still says the same things. ErrorCode=-2147217900 is also the same.
¤

Both Name and Date are reserved words.


Paul
~~~~
Microsoft MVP (Visual Basic)

AddThis Social Bookmark Button