Microsoft Access数据库引擎找不到对象'Sheet1 $' [英] The Microsoft Access database engine could not find the object 'Sheet1$'

查看:1671
本文介绍了Microsoft Access数据库引擎找不到对象'Sheet1 $'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  string  connectionString =  @  Provider = Microsoft.ACE.OLEDB.12.0; Data Source = + filename +   ;扩展属性='Excel 12.0 xml; HDR = YES;'; 
string strSQL = SELECT * FROM [工作表Sheet $];
OleDbConnection excelConnection = new OleDbConnection(connectionString);
excelConnection.Open();
OleDbCommand dbCommand = new OleDbCommand(strSQL,excelConnection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(dbCommand);
dataAdapter.Fill(dsExcelData);



收到此错误Microsoft Access数据库引擎无法找到对象''Sheet1 $''。确保对象存在,并正确拼写其名称和路径名。如果''Sheet1 $''不是本地对象,请检查您的网络连接或联系服务器管理员。当我运行此片时代码。

错误的解决方案是什么?

请回答asap..urgent ..

解决方案

< blockquote>;
OleDbConnection excelConnection = new OleDbConnection(connectionString);
excelConnection.Open();
OleDbCommand dbCommand = new OleDbCommand(strSQL,excelConnection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(dbCommand) ;
dataAdapter.Fill(dsExcelData);



收到此错误 Microsoft Access数据库引擎找不到对象''Sheet1


''。确保对象存在,并且您正确拼写其名称和路径名称。如果''Sheet1


''不是本地对象,请检查您的网络连接或联系服务器管理员。当我运行这段代码时。

错误的解决方案是什么?

请回答asap..urgent ..


string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filename + ";Extended Properties='Excel 12.0 xml;HDR=YES;'";
string strSQL = "SELECT * FROM [Sheet1$]";
                OleDbConnection excelConnection = new OleDbConnection(connectionString);
excelConnection.Open();
OleDbCommand dbCommand = new OleDbCommand(strSQL, excelConnection);
                OleDbDataAdapter dataAdapter = new OleDbDataAdapter(dbCommand);
dataAdapter.Fill(dsExcelData);


getting this error "The Microsoft Access database engine could not find the object ''Sheet1$''. Make sure the object exists and that you spell its name and the path name correctly. If ''Sheet1$'' is not a local object, check your network connection or contact the server administrator." when i run this piece of code.
What is the solution for the error?
Pls answer asap..urgent..

解决方案

"; OleDbConnection excelConnection = new OleDbConnection(connectionString); excelConnection.Open(); OleDbCommand dbCommand = new OleDbCommand(strSQL, excelConnection); OleDbDataAdapter dataAdapter = new OleDbDataAdapter(dbCommand); dataAdapter.Fill(dsExcelData);


getting this error "The Microsoft Access database engine could not find the object ''Sheet1


''. Make sure the object exists and that you spell its name and the path name correctly. If ''Sheet1


'' is not a local object, check your network connection or contact the server administrator." when i run this piece of code.
What is the solution for the error?
Pls answer asap..urgent..


这篇关于Microsoft Access数据库引擎找不到对象'Sheet1 $'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆