Hi
i want to get contact details from outlook and display that contact details in my datagrid view using csv file. My grid view display only few columns such as Name, Address, Email and category. In outlook i will add the contact details such as First Name, LastName, Business address or Home address and category save these details after that create csv file for added contact folder. My code is here
private
DataTable ReadCSV(string Filename)
{
string MyPath = System.IO.Path.GetDirectoryName(Filename);
string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + MyPath + ";Extended Properties='text;HDR=Yes;FMT=Delimited'";
string CmdText = "select [First Name] & '' & [Middle Name] & ' ' & [Last Name] as [Name], [Business Street] & [Business City] as [Address], [E-mail Address] as [Email Id],Categories as [Category] from " + System.IO.Path.GetFileName(Filename);
OleDbConnection Con = new OleDbConnection(ConnectionString);
OleDbDataAdapter adptr = new OleDbDataAdapter(CmdText, Con);
DataSet Ds = new DataSet();
adptr.Fill(Ds);
return Ds.Tables[0];
}
after select the csv file i will click 'Show contact' button, at that time i will get Error message as
"Syntax error in From clause". (These error displayed occurred at some times only) i dont know how to solve these. please any one can help me. i need solution urgently.