I have the following code to open an excel sheet
{
OpenFileDialog dlg = new OpenFileDialog(); DialogResult dlgResult = dlg.ShowDialog(); if (dlgResult == DialogResult.OK){
string conString = System.IO.Path.GetFileName(dlg.FileName);}
axMappointControl1.NewMap(MapPoint.
GeoMapRegion.geoMapEurope);MapPoint.
Route route = axMappointControl1.ActiveMap.ActiveRoute; string myConString = @"Provider=Microsoft.Jet.OLEDB.4.0;data source=" ++ conString +
@";Extended Properties=Excel 8.0;";
The code is returning an error for conString, " The name 'conString' does not exist in the current context."
I want to be able to select the excel file from an OpenFileDialog and then use the filename as part of the connection string.
Where am i going wrong with this?
Please help.
Antony GriffithsPosted Jun 28, 2008, 10:20 AM
That sorted it. Thanks.
Sometimes the answers are so simple.
Bechir BejaouiPosted Jun 28, 2008, 5:14 AM
string conString = ""; and try again