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.