If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Best / Easier Way to import From DBF to SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-14-03, 18:08
vextout vextout is offline
Registered User
 
Join Date: Jan 2003
Location: New York
Posts: 160
Best / Easier Way to import From DBF to SQL

I get a dbf file to upload about twice and each file changes its structure. I am trying to make a vb app to import the dbf to sql with easy for the user. The user will choose the path and filename of the dbf and choose the database name that will be in sql server.

What is the best or easiest way to import a dbf file to sql 2000.

I was thinking 4 ways, but not sure how to do them 100%/

1 - Search all columns and data lengths on the dbf then create a table in sql and then try a select into thing or something

2 - Make a stored procedure imports dbf (or any format) to sql without alot of coding. (if alot of coding oh well)

3 - Something with BCP ???

4 - any way you cna think of please let me know.

I seen some code that imports sqldb to sqldb but not from an external db.

thnx
__________________
Beyond Limitation

Last edited by vextout; 06-15-03 at 11:03.
Reply With Quote
  #2 (permalink)  
Old 06-20-03, 21:26
vextout vextout is offline
Registered User
 
Join Date: Jan 2003
Location: New York
Posts: 160
I GOT IT - for all who need it

i got this to work after about a week and a half

Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
conn.Open "DSN=***;uid=***;pwd=***"

'Select names from dbf file and insert into a new table

strSQL = "select * into " & txtSQLTableName.Text & " from OpenRowset('MSDASQL', 'Driver={Microsoft dBase Driver (*.dbf)};" & _
"DefaultDir=" & dirSD.Path & ";','select * from " & File1.FileName & "')"
rs.Open strSQL, conn, adOpenDynamic, adLockOptimistic
__________________
Beyond Limitation
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On