473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Copying from one db into another

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


Jan 12 '07 #1
5 965
What happened when you tried it?
"John" <Jo**@nospam.infovis.co.ukwrote in message
news:ef*************@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


Jan 12 '07 #2
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@localhostwrote in message
news:u3**************@TK2MSFTNGP06.phx.gbl...
What happened when you tried it?
"John" <Jo**@nospam.infovis.co.ukwrote in message
news:ef*************@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



Jan 12 '07 #3
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" <Jo**@nospam.infovis.co.ukwrote in message
news:uV**************@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@localhostwrote in message
news:u3**************@TK2MSFTNGP06.phx.gbl...
>What happened when you tried it?
"John" <Jo**@nospam.infovis.co.ukwrote in message
news:ef*************@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




Jan 12 '07 #4
Thanks. Still says the same things. ErrorCode=-2147217900 is also the same.

Regards

"Stephany Young" <noone@localhostwrote in message
news:el**************@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" <Jo**@nospam.infovis.co.ukwrote in message
news:uV**************@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@localhostwrote in message
news:u3**************@TK2MSFTNGP06.phx.gbl...
>>What happened when you tried it?
"John" <Jo**@nospam.infovis.co.ukwrote in message
news:ef*************@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




Jan 12 '07 #5
On Fri, 12 Jan 2007 13:32:26 -0000, "John" <Jo**@nospam.infovis.co.ukwrote:

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

Both Name and Date are reserved words.
Paul
~~~~
Microsoft MVP (Visual Basic)
Jan 12 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore...
1
by: Caroline | last post by:
I need to update a table by copying a column from another table (having the same structure, but on another database), from the record having the same primary key. 1 - What is the correct...
6
by: ziwu | last post by:
std::copy() is a function from C++ library. Is memcpy() a function from C library, or is it re-implemented in C++ library? Why people say "In C++, don't use memcpy for non-POD types? What is...
4
by: zMisc | last post by:
Is it possible to copy a table from one schema to another schema by just copying the frm file to the directory for the new schema? What is the best way to create a new database with all the...
1
by: Mike9900 | last post by:
What is the best way to copy DataRow from one table to another table, without copying its structure, which means copying only its data. -- Mike
6
by: Jim Heavey | last post by:
I have written a little application which copies files from one location to another location. Before it copies the file, it ensure the directory for both the from and to locations is valid. It...
0
by: berwiki | last post by:
I am trying to copy a table to another SQL 2000 Database, but I continually get errors. When I right-click, choose All-Tasks, Export-Data and go through the DTS settings, I get an 'Unspecified...
5
by: ozzii | last post by:
Hi I am using the following code to copy data from one database table into another database table: SELECT * INTO Products From exportdb.mdb.exporttable However the query simply deletes...
9
by: Jess | last post by:
Hello, I tried to clear a vector "v" using "v.clear()". If "v" contains those objects that are non-built-in (e.g. string), then "clear()" can indeed remove all contents. However, if "v"...
13
by: writeson | last post by:
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.