Click here to Skip to main content
12,823,439 members (47,059 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# C#4.0
Please give me the solution

give me the exact souttion
Posted 15-Nov-12 23:04pm
Updated 15-Nov-12 23:06pm
Nelek 16-Nov-12 4:08am
Do you realize you are demanding in a place where people help because they want to do it and where the main objective is to learn.
Such a post won't give you many results

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


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 = ";
//Define these three variables
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;

da = new OleDb.OleDbDataAdapter(sql, con);
da.Fill(ds, dbTableName);
MaxRows = ds.Tables("FancyName").Rows.Count;

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";
//Save outputCSV to file, either by Save File Dialog or StreamWriter.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 27 May 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100