Thread View: alt.pl.comp.lang.csharp
7 messages
7 total messages
Started by qaz
Fri, 11 Jun 2010 07:28
c# i dbf
Author: qaz
Date: Fri, 11 Jun 2010 07:28
Date: Fri, 11 Jun 2010 07:28
2 lines
1099 bytes
1099 bytes
Jak przeczytać tabele Visual Fox Pro (.dbf ) ? qaz
Re: c# i dbf
Author: Adam Kłobukowski
Date: Fri, 11 Jun 2010 08:25
Date: Fri, 11 Jun 2010 08:25
6 lines
978 bytes
978 bytes
W dniu 11.06.2010 09:28, qaz pisze: > Jak przeczyta� tabele Visual Fox Pro (.dbf ) ? Google zniknęło? AdamK
Re: c# i dbf
Author: qaz
Date: Fri, 11 Jun 2010 09:59
Date: Fri, 11 Jun 2010 09:59
11 lines
1473 bytes
1473 bytes
Użytkownik "Adam Kłobukowski" <adam@klobukowski.pl> napisał w wiadomości news:husrth$ugs$1@node1.news.atman.pl... >W dniu 11.06.2010 09:28, qaz pisze: >> Jak przeczyta? tabele Visual Fox Pro (.dbf ) ? > > Google zniknęło? Zniknęła umiejętność/możliwość dogadania się z ODBC - ale dzięki za pomoc nieocenioną qaz
Re: c# i dbf
Author: qaz
Date: Fri, 11 Jun 2010 10:32
Date: Fri, 11 Jun 2010 10:32
9 lines
1537 bytes
1537 bytes
Użytkownik "qaz" <qazvox29a@wp.pl> napisał w wiadomości news:4c11e5b8$0$17095$65785112@news.neostrada.pl... > Jak przeczytać tabele Visual Fox Pro (.dbf ) ? OLE DB ( http://www.microsoft.com/downloads/details.aspx?FamilyId=E1A87D8F-2D58-491F-A0FA-95A3289C5FD4&displaylang=en ) :-)
Re: c# i dbf
Author: TheBest
Date: Sat, 12 Jun 2010 07:19
Date: Sat, 12 Jun 2010 07:19
6 lines
1085 bytes
1085 bytes
qaz pisze: > Jak przeczytać tabele Visual Fox Pro (.dbf ) ? OLE DB http://www.microsoft.com/downloads/details.ASPx?familyid=e1a87d8f-2d58-491f-a0fa-95a3289c5fd4&displaylang=en jest z tymi tabelami tylko jeden problem - wydajnosc
Re: c# i dbf
Author: Tadeusz Olszewski
Date: Sat, 12 Jun 2010 09:34
Date: Sat, 12 Jun 2010 09:34
79 lines
3682 bytes
3682 bytes
Użytkownik "TheBest" <colbyco@gazeta.pl> napisał w wiadomości
news:t2pbe7-88m.ln1@alfa.polanka.net.pl...
> qaz pisze:
>> Jak przeczytać tabele Visual Fox Pro (.dbf ) ?
>
> OLE DB
> http://www.microsoft.com/downloads/details.ASPx?familyid=e1a87d8f-2d58-491f-a0fa-95a3289c5fd4&displaylang=en
> jest z tymi tabelami tylko jeden problem - wydajnosc
1. A jakie ilości danych chcesz przetwarzać?
2. Czy pliki .dbf, które przetwarzasz to rzeczywiście pliki pochodzące od
Foxa czy może dBase czy dBase4 a może jeszcze coś innego?
Po kilku próbach, rozwiązania problemu pod tytułem czytanie plików dba i
zapis do plików ja wybrałem takie rozwiązanie:
Czytanie:
public DataTable GetData(string file)
{
System.Data.OleDb.OleDbConnection conn = new
System.Data.OleDb.OleDbConnection();
string directory = System.IO.Path.GetDirectoryName(file);
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" + directory + ";Extended Properties=dBASE IV;User
ID=Admin;Password=";
conn.Open();
System.Data.OleDb.OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = @"SELECT * FROM " + file;
DataTable dt = new DataTable();
dt.Load(cmd.ExecuteReader());
conn.Close();
return dt;
}
Zapis:
internal void SaveData(string dbfFile, DataTable dt)
{
string directory = System.IO.Path.GetDirectoryName(file);
if (directory.Substring(directory.Length - 1, 1) != @"\")
directory += @"\";
OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" + directory + ";Extended Properties=dBASE IV;User
ID=Admin;Password=";
conn.Open();
System.Data.OleDb.OleDbCommand cmdSelect = conn.CreateCommand();
cmdSelect.CommandType = CommandType.Text;
cmdSelect.CommandText = @"SELECT * FROM " + file;
DataTable dtSelect = new DataTable();
dtSelect.Load(cmdSelect.ExecuteReader());
OleDbDataAdapter dbfAdapter = new
OleDbDataAdapter(cmdSelect.CommandText, conn);
dbfAdapter.Fill(dbfDt);
OleDbCommandBuilder builder = new
OleDbCommandBuilder(dbfAdapter);
System.Data.OleDb.OleDbCommand insertCmd =
builder.GetInsertCommand();
dbfAdapter.InsertCommand = insertCmd;
dbfAdapter.Update(dt);
dbfAdapter.Dispose();
conn.Close();
}
Re: c# i dbf
Author: Tadeusz Olszewski
Date: Sat, 12 Jun 2010 11:49
Date: Sat, 12 Jun 2010 11:49
9 lines
1145 bytes
1145 bytes
Użytkownik "Tadeusz Olszewski" <olszewski.tadeusz.usun@wp.pl> >> >> dbfAdapter.Fill(dbfDt); >> Ta linia jest niepotrzebna, Pozdrawiam Tadeusz
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads