TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Deepak Goyal
NA
64
0
exception in connecting the xls file in C# ASP .net
Jul 9 2009 5:45 AM
I an facing a problem if some one can help it will be greate.
I have a XLS file as a database from which I want to get data.
But every time VS 2005 comes out with an exception
The
Microsoft
Jet database engine could not find the object 'user_account$'. Make sure the object exists and that you spell its name and the path name correctly.
my code is as below
public int verify_user(string filename, string user_passed)
{
String connectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
OleDbCommand selectCommand = new OleDbCommand("SELECT * FROM [user_account$]", connection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter();
dataAdapter.SelectCommand = selectCommand;
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
connection.Close();
DataTable dataTable = dataSet.Tables[0];
int cols = dataTable.Columns.Count;
int rows_count= dataTable.Columns.Count;
return rows_count;
}
Reply
Answers (
2
)
Choosing row to databind
Updating database using dataset and data adapter not working (ms access)