Click here to Skip to main content
12,302,514 members (64,985 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 22:04pm
Edited 15-Nov-12 22:06pm
Nelek94.1K
v2
Comments
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
 
good
Please Sign up or sign in to vote.

Solution 1

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 = ";
//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;
 

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

Jacques
  Permalink  

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
Web01 | 2.8.160530.1 | Last Updated 27 May 2015
Copyright © CodeProject, 1999-2016
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