问题描述
publicstaticDataSetgetDataSet(stringsqlStr,stringsTable){DataSetset2;OleDbConnectionselectConnection=getConn();try{//selectConnection.Open();OleDbDataAdapteradapter=newOleDbDataAdapter(sqlStr,selectConnection);DataSetdataSet=newDataSet();if(dataSet.Tables.Contains(sTable)){dataSet.Tables[sTable].Clear();}adapter.Fill(dataSet,sTable);set2=dataSet;}catch(Exceptionexception){throwexception;//////错误位置,显示exception是无效的文件名}finally{selectConnection.Close();selectConnection=null;}returnset2;}
解决方案
解决方案二:
一般是数据库路径不对
解决方案三:
数据文件不存在~
解决方案四:
检查了一下,路径是对的,文件也确实是存在的啊
解决方案五:
路径放出来看看
解决方案六:
publicArcCatalog(){InitializeComponent();sAccessConn=LSCommonHelper.DataBaseHelper.GetAccess2007ConnectionString(Application.StartupPath+@"F:ArcCatalogGIS_VS2010LSArcCatalogbinDebugDatagis.accdb");LSCommonHelper.DataBaseHelper.AccessConnectionString=sAccessConn;LSCommonHelper.DataBaseHelper.Connstring=sAccessConn;LSCommonHelper.ControlStyleHelper.InitListViewStyle(this.listView1,false);LoadTreeView();LoadArcToolbox();this.dockPanel1.Text="数据连接";