|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Copying from one db into anotherI 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="RemoteDB";Persist Security Info=True;User ID="username";Password=password];", LocalConn) DBCommand.ExecuteNonQuery() LocalConn.Close() The remote db is a sql server. Many Thanks Regards 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="RemoteDB";Persist Security Info=True;User > ID="username";Password=password];", LocalConn) > > DBCommand.ExecuteNonQuery() > > LocalConn.Close() > > The remote db is a sql server. > > Many Thanks > > Regards > > > > 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="RemoteDB";Persist Security >> Info=True;User ID="username";Password=password];", LocalConn) >> >> DBCommand.ExecuteNonQuery() >> >> LocalConn.Close() >> >> The remote db is a sql server. >> >> Many Thanks >> >> Regards >> >> >> >> > > 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="RemoteDB";Persist Security >>> Info=True;User ID="username";Password=password];", LocalConn) >>> >>> DBCommand.ExecuteNonQuery() >>> >>> LocalConn.Close() >>> >>> The remote db is a sql server. >>> >>> Many Thanks >>> >>> Regards >>> >>> >>> >>> >> >> > > 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="RemoteDB";Persist Security >>>> Info=True;User ID="username";Password=password];", LocalConn) >>>> >>>> DBCommand.ExecuteNonQuery() >>>> >>>> LocalConn.Close() >>>> >>>> The remote db is a sql server. >>>> >>>> Many Thanks >>>> >>>> Regards >>>> >>>> >>>> >>>> >>> >>> >> >> > > |
|||||||||||||||||||||||