How can I access excel from VB2008 Express.net
I have tried but having difficulty with understanding MDAC error.
Anybody help please?
: I have tried but having difficulty with understanding MDAC error.
: Anybody help please?
which connection you have used? Can you more details.
But, as for as i know you can use OLEDB connection for accessing the, excel sheet from .net applications.
If you need the code I will post it over here.
: : I have tried but having difficulty with understanding MDAC error.
: : Anybody help please?
: : Thanks
: which connection you have used? Can you more details.
: But, as for as i know you can use OLEDB connection for accessing
: the, excel sheet from .net applications.
: If you need the code I will post it over here.
Thanks for the reply.
The error message of 'The .Net Framework Data Providers require Microsoft Data Access Components(MDAC). Please install Microsoft Data Access Components(MDAC) version 2.6 or later' comes from VB Help for downloading from Excel to dataset. Where can I check whether I have got it?
It sounds as though your offer to send me the code would be very useful.
: : : I have tried but having difficulty with understanding MDAC error.
: : : Anybody help please?
: : : Thanks
: : :
: : which connection you have used? Can you more details.
: : But, as for as i know you can use OLEDB connection for accessing
: : the, excel sheet from .net applications.
: : If you need the code I will post it over here.
: Thanks for the reply.
: The error message of 'The .Net Framework Data Providers require
: Microsoft Data Access Components(MDAC). Please install Microsoft
: Data Access Components(MDAC) version 2.6 or later' comes from VB
: Help for downloading from Excel to dataset. Where can I check
: whether I have got it?
: It sounds as though your offer to send me the code would be very
I think you are using some wizard for connecting it with the Excel sheet to dataset. But I have done it programatically. Here is the Code for getting the Excel sheet data into DataSet.
public string GetOledbConnectionString(string fileName)
return "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + fileName + ";" + "Extended Properties='Excel 8.0;HDR=YES;'";
//give ur call this function and pass the filename with fullpath
public void RawUploadDumpEntries(string fileName)
string stroledbConnectionString = helperObject.GetOledbConnectionString(fileName);
OleDbConnection oledbRevenueImportConnection = new OleDbConnection(stroledbConnectionString);
string strCommand ="select * from [sheetName$]";
OleDbCommand oledbImportCommand = new OleDbCommand(strCommand, oledbRevenueImportConnection);
OleDbDataAdapter oledbAdapter = new OleDbDataAdapter(oledbRevenueImportCommand);
DataSet ds = new DataSet();
catch (OleDbException oledbException)
throw new Exception("Put your error messaged here", oledbException);
If u still face some problem. Post here I will let you know, what can be done.
Appologies for not replying sooner but this is the first time I have used a forum and my replies got lost - operator error!!
Many thanks for your reply. Unfortunately it is in 'C'(?) which I don't know so I am having difficulty in transposing it.
This was my first attempt:
Public Sub ReadIntoDataSet()
Dim cn As OleDbConnection
Dim cmd As OleDbDataAdapter
Dim dataset1 As New DataSet()
cn = New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=d:WeatherData 8Weather 2008_12.xls;Extended Properties=Excel 8.0")
cmd = New OleDbDataAdapter("select * from [AnnualData$]", cn)
The program stalls at the line cn.Open() and gives the MDAC error message.
Do you think you could amend my code or suggest a way to stop the MDAC error message?
The problem in you code is nothing much big. For a adapter like SqlDataAdapter or oledb adapter you no need to open the connection mannualy, i mean the statement "[b]cn.open()[/b]", is not necessary at all. Since the adapter will take care of all those things. "cn.close()" is also not necessary as far as i know. But you can still specify, if you get MDAC error at that place.
It looks like you're new here. If you want to get involved, click one of these buttons!
Assembly Code Share
Getting started in assembly
C and C++
C/C++ on Linux/Unix
C/C++ Windows API
C++ Game Development
Delphi and Kylix
Java Server Pages
Access databases and VB
Advance Visual Basic
DirectX Game dev
Newbie Game Programmers
Cooling & Overclocking
Database & SQL
Sound & Music
FreeLance Software City
C# & VB.NET School Support
Join the Team
Comments on this site
New programming languages
Off topic board
Mobile & Wireless
Operating Systems & Platforms
Witsbits Go Cloud
Embedded / RTOS
Windows CE & Pocket PC
Networking And Security
Windows 2003 Server
RUP & UML
Quality & Testing
Active Server Pages
HTML & WEB-Design
Mobile Internet & Messaging
WEB-Services / SOAP
In this Discussion