Hi
Hope this does what you want it to.
OleDb.OleDbConnection con = new OleDb.OleDbConnection();
string dbProvider = null;
string dbSource = null;
string dbTableName = null;
string sql1 = null;
int MaxRows = 0;
string outputCSV = "";
dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = ";
dbSource = "C:/Marks.mdb";
dbTableName = "Science_Marks";
int noOfColumns = 1;
con.ConnectionString = dbProvider + dbSource;
DataSet ds = new DataSet();
OleDb.OleDbDataAdapter da;
sql1 = "SELECT * FROM " + dbTableName;
con.Open();
da = new OleDb.OleDbDataAdapter(sql, con);
da.Fill(ds, dbTableName);
MaxRows = ds.Tables("FancyName").Rows.Count;
con.Close();
for (int i = 0; i < MaxRows; i++) {
for (int j = 0; j < noOfColumns; j++) {
outputCSV = outputCSV + ds.Tables("FancyName").Rows(i).Item(j)+",";
}
outputCSV = outputCSV + "\r\n";
}
Jacques