hii
try to query out db file to DataTable
and it work great!!
but i get all db file includding Rows that as be deleted.
Thare is away to quey out db file with out These deleted rows??

System.Data.Odbc.OdbcConnection oConn = new System.Data.Odbc.OdbcConnection(); 
            oConn.ConnectionString = @"Driver={Microsoft dBase Driver (*.dbf)};SourceType=DBF;SourceDB=D:\databases\;Exclusive=No; Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;"; 
            oConn.Open(); 
            System.Data.Odbc.OdbcCommand oCmd = oConn.CreateCommand(); 
            oCmd.CommandText = @"SELECT * FROM D:\databases\xxx.dbf" ; 
            DataTable dt = new DataTable(); 
            dt.Load(oCmd.ExecuteReader()); 
            oConn.Close();

Recommended Answers

All 4 Replies

I do not understand what you're asking. That query pulls in all rows from the database so I'm guessing that you are deleting the rows in code? If so you didn't post the code. You can call DataTable.AcceptChanges() to commit all changes made to the datatable.

If my guess was way off mark then please explain your problem more clearly and provide the relevant code.

hi
i have complete dbf file including Rows that has been marked as deleted.
Is it possible to extract from the dbf file just the "deleted" rows??

another solution!!!

String ConnectionString;
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=D:\Data;Extended Properties=dBase IV";
System.Data.OleDb.OleDbConnection dBaseConnection =New System.Data.OleDb.OleDbConnection(ConnectionString);
dBaseConnection.Open();

System.Data.OleDb.OleDbCommand dBaseCommand =New System.Data.OleDb.OleDbCommand("SELECT * FROM D:\Data\Eyal.DBF",dBaseConnection);
System.Data.OleDb.OleDbDataReader dBaseDataReader =
dBaseCommand.ExecuteReader(CommandBehavior.SequentialAccess);
if(dBaseDataReader!=null)
{        
While (dBaseDataReader.Read())
        {            
            Console.WriteLine(dBaseDataReader("Column1").ToString);
            Console.WriteLine(dBaseDataReader("Column2").ToString);
            Console.WriteLine(dBaseDataReader("Column3").ToString);
        }
}
dBaseDataReader=null;
dBaseConnection.Close();

again tank's for trying;
eyal.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.