I am working with a dbf database. I need to query it to get information back in string format. The dbf file is set up as follows:
Student Name Student Number Student Description
HelloWorld 123456789 Present
WorldHello 987654321 Absent
Here is the code i have so far:
OleDbCommand command;
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " + dbfPath + ";Extended Properties=dBase III");
command = new OleDbCommand("SELECT STUDENTNAME, STUDENTNUMBER, STUDENTDESCRIPTION" + " FROM " + DbfFile + " WHERE " + STUDENTNAME='HelloWorld', conn);
Now i want to get the result as a comma seperated string as follows:
HelloWorld,123456789,Present
How can i do this?
Fetch the results using a DataReader (as explained here), and concatenate the results: