dbTalk Databases Forums  

How to copy DBF to SQL-import of DBF's table structure issue...

comp.databases comp.databases


Discuss How to copy DBF to SQL-import of DBF's table structure issue... in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Napi
 
Posts: n/a

Default How to copy DBF to SQL-import of DBF's table structure issue... - 09-13-2007 , 02:14 AM






The main question is the same as in the topic - I would like to import
information about DBF's table structure to some ArrayList instead of
writing it directly. I have _many_ tables to import...

I use OleDBConnection. Here is the code:

-------------------------------------------------------

public string connstr1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=";
public string connstr2 = ";Extended Properties=dBase III";

public DataSet GetFile(string path, string table, DataSet
myDataSet)
{
if (File.Exists(path + "\\" + table + ".DBF"))
{
OleDbConnection connection = new OleDbConnection(connstr1
+ path + connstr2);
connection.Open();
string query = "";
query = "SELECT * FROM " + table;
OleDbCommand dquery = new OleDbCommand(query, connection);
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = new OleDbCommand(query,
connection);
adapter.Fill(myDataSet, table);
connection.Close();
}
else
{
LogIt(201, "Plik: " + path + "\\" + table + ".DBF nie
istnieje");
}
return myDataSet;
}

--------------------------------------

Can I receive it from the adapter or maybe the dataset?
Thank you in advance,
PiotreK


Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.