Showing posts with label vb6i. Show all posts
Showing posts with label vb6i. Show all posts

Monday, March 19, 2012

Importing DBase tables into MSDE using ADO

What is the syntax for a SQL import from DBase IV into MSDE 2000 using ADO
in VB6
I am using ...
Set cn1 = New ADODB.Connection
cn1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog='Tramcars';Data Source=PM" (Note PM is
my SQL server name and Catalog tramcars exists)
sql = "Select * Into [base] from [dbase
IV;DATABASE=c:\tramcars\Bakery\].[base.dbf]"
cn1.Execute sql
I get error message 'Invalid Object Name dbase
IV;DATABASE=c:\tramcars\Bakery\.base.dbf'
---
Using...
cn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
App.path & "\Data\Tramcars.mdb;Persist Security Info=False"
sql = "Select * Into [base] from [dbase
IV;DATABASE=c:\tramcars\Bakery\].[base.dbf]"
cn1.Execute sql
works fine and imports DB table to Access 2000
Regards
steve
Try:
select * from OPENROWSET('MSDASQL',
'Driver={Microsoft dBase Driver};SourceDB=c:\tramcars\Bakery\;SourceType=db f',
'select * from base')
or better yet, create a linked server to dbase:
EXEC sp_addlinkedserver
'DBF',
'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0',
'c:\tramcars\Bakery\',
NULL,
'dBase IV'
exec sp_addlinkedsrvlogin
@.rmtsrvname = 'DBF',
@.useself = false,
@.locallogin = NULL,
@.rmtuser = NULL,
@.rmtpassword = NULL
select * from openquery(DBF,'select * from base')x
-oj
http://www.rac4sql.net
"steve" <sfrancis@.bigpond.net.au> wrote in message
news:OmzOkbmNEHA.3812@.TK2MSFTNGP12.phx.gbl...
> What is the syntax for a SQL import from DBase IV into MSDE 2000 using ADO
> in VB6
> I am using ...
> Set cn1 = New ADODB.Connection
> cn1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
> Security Info=False;Initial Catalog='Tramcars';Data Source=PM" (Note PM is
> my SQL server name and Catalog tramcars exists)
> sql = "Select * Into [base] from [dbase
> IV;DATABASE=c:\tramcars\Bakery\].[base.dbf]"
> cn1.Execute sql
> I get error message 'Invalid Object Name dbase
> IV;DATABASE=c:\tramcars\Bakery\.base.dbf'
> Using...
> cn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> App.path & "\Data\Tramcars.mdb;Persist Security Info=False"
> sql = "Select * Into [base] from [dbase
> IV;DATABASE=c:\tramcars\Bakery\].[base.dbf]"
> cn1.Execute sql
> works fine and imports DB table to Access 2000
> ----
> Regards
> steve
>
|||oj
Thanks
Worked a treat
Steve
"oj" <nospam_ojngo@.home.com> wrote in message
news:uTBcBx$NEHA.3016@.tk2msftngp13.phx.gbl...
> Try:
> select * from OPENROWSET('MSDASQL',
> 'Driver={Microsoft dBase
Driver};SourceDB=c:\tramcars\Bakery\;SourceType=db f',[vbcol=seagreen]
> 'select * from base')
> or better yet, create a linked server to dbase:
> EXEC sp_addlinkedserver
> 'DBF',
> 'Jet 4.0',
> 'Microsoft.Jet.OLEDB.4.0',
> 'c:\tramcars\Bakery\',
> NULL,
> 'dBase IV'
> exec sp_addlinkedsrvlogin
> @.rmtsrvname = 'DBF',
> @.useself = false,
> @.locallogin = NULL,
> @.rmtuser = NULL,
> @.rmtpassword = NULL
> select * from openquery(DBF,'select * from base')x
> --
> -oj
> http://www.rac4sql.net
>
> "steve" <sfrancis@.bigpond.net.au> wrote in message
> news:OmzOkbmNEHA.3812@.TK2MSFTNGP12.phx.gbl...
ADO[vbcol=seagreen]
Security=SSPI;Persist[vbcol=seagreen]
PM is
>