473,785 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert Excel to dataset

Hi
when i convert Excel file to dataset using the following code, i find
that, some col. such as

Col1
------
404
403
NOT
222
is converted as

col1
-----
404
403
<null>
222

..I use this code to convert
Dim cnn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0; " +
"data source='" + SaveLocation + " '; " + "Extended Properties='Exc el
8.0;IMEX=1;'")
Dim da As New OleDbDataAdapte r("select * from
[Sheet1$]", cnn)
da.TableMapping s.Add("Table", "TableCom")
Dim ds As New DataSet
da.Fill(ds)

Please help me in this

Aug 4 '06 #1
2 6359
On 4 Aug 2006 06:06:40 -0700, "karups" <al***********@ gmail.comwrote:

¤ Hi
¤ when i convert Excel file to dataset using the following code, i find
¤ that, some col. such as
¤
¤ Col1
¤ ------
¤ 404
¤ 403
¤ NOT
¤ 222
¤
¤
¤ is converted as
¤
¤ col1
¤ -----
¤ 404
¤ 403
¤ <null>
¤ 222
¤
¤ .I use this code to convert
¤ Dim cnn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0; " +
¤ "data source='" + SaveLocation + " '; " + "Extended Properties='Exc el
¤ 8.0;IMEX=1;'")
¤ Dim da As New OleDbDataAdapte r("select * from
¤ [Sheet1$]", cnn)
¤ da.TableMapping s.Add("Table", "TableCom")
¤ Dim ds As New DataSet
¤ da.Fill(ds)
¤

The IMEX argument should have taken care of the mixed mode column issue.

You could also try changing the TypeGuessRows setting in the registry to 0. It is found at:

HKEY_LOCAL_MACH INE\SOFTWARE\Mi crosoft\Jet\4.0 \Engines\Excel

I'm assuming your connection string is being evaluated properly but you may want to try double
quotes instead of single quotes:

"Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=" & SaveLocation & ";Extended Properties=""Ex cel 8.0;IMEX=1"""
Paul
~~~~
Microsoft MVP (Visual Basic)
Aug 4 '06 #2

Paul Clement wrote:
On 4 Aug 2006 06:06:40 -0700, "karups" <al***********@ gmail.comwrote:

¤ Hi
¤ when i convert Excel file to dataset using the following code, i find
¤ that, some col. such as
¤
¤ Col1
¤ ------
¤ 404
¤ 403
¤ NOT
¤ 222
¤
¤
¤ is converted as
¤
¤ col1
¤ -----
¤ 404
¤ 403
¤ <null>
¤ 222
¤
¤ .I use this code to convert
¤ Dim cnn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0; " +
¤ "data source='" + SaveLocation + " '; " + "Extended Properties='Exc el
¤ 8.0;IMEX=1;'")
¤ Dim da As New OleDbDataAdapte r("select * from
¤ [Sheet1$]", cnn)
¤ da.TableMapping s.Add("Table", "TableCom")
¤ Dim ds As New DataSet
¤ da.Fill(ds)
¤

The IMEX argument should have taken care of the mixed mode column issue.

You could also try changing the TypeGuessRows setting in the registry to 0. It is found at:

HKEY_LOCAL_MACH INE\SOFTWARE\Mi crosoft\Jet\4.0 \Engines\Excel

I'm assuming your connection string is being evaluated properly but you may want to try double
quotes instead of single quotes:

"Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=" & SaveLocation & ";Extended Properties=""Ex cel 8.0;IMEX=1"""
Paul
~~~~
Microsoft MVP (Visual Basic)


ya that worked for me now
Thats great
I changed in the registry and its fetching the records correctly..
Thank u paul

Aug 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8012
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
9
8900
by: Paul | last post by:
Hi all Arggghhh........... The problem.....I want the user to be able to create an excel document and name particular cells in the document where they want the data to be placed and then save this out of an XML file or Excel Template file. Next I need to convert a dataset to xml and try and transform this data into the users xml file..........i've seen a few things on this but havent had much success...
7
11785
by: kscdavefl | last post by:
I am running the following code to retrieve a DataSet: public DataView CreateGroupSource() { string groupConnect = Session.ToString(); string groupSelect = "Select grpname from Maxusergroups where usrname = " + "'" + userText.Text + "'"; oda = new OleDbDataAdapter(groupSelect, groupConnect); DataSet ds = new DataSet(); oda.Fill(ds, "group");
1
1921
by: TaeHo Yoo | last post by:
How to convert a dataset to excel spreadsheet in windows based application?? Thanks a lot in advance. *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it!
1
2067
by: SL | last post by:
Hi - I'm fairly new to manipulating xml and I have an excel workbook and on one of the sheets is apparently a listobject... using it's xmlmap.export function I get an xml file that looks like this (truncated of course, you get the idea): <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns1:TransactionDetails xmlns:ns1="urn:Microsoft.IT.LicensePosition" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ns1:Trans> ...
2
23027
by: Ronald S. Cook | last post by:
Hi, I need to open an Excel file from within my ASP.NET app and read data. I'm guessing the most like format in ASP.NET would be a DataTable. Regardles,, how do I get the data into my ASP.NET app from the Excel file? I have made a reference to the Excel 11.0 object library, but am not sure what code comes next. Thanks,
2
331
by: karups | last post by:
Hi when i convert Excel file to dataset using the following code, i find that, some col. such as Col1 ------ 404 403 NOT 222
2
3124
by: Mad Scientist Jr | last post by:
>From an asp.net web page I want the user to open the results of a SQL query in Excel, as automatically as possible (ie not having to loop through columns, rows, in code). For this, dataset.writexml works great (got the code from http://forums.devx.com/archive/index.php/t-57273.html ) The only question I have is, when Excel opens up, it isn't the view I would prefer. It opens as a read-only workbook, I would prefer as an
3
2272
by: binny | last post by:
i use jet engine ,and oledb database but with this i get four errors which r compile time errores,plz help me to solve these errors i wrote this programe bt it is not working . using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; using System.Net.Security;
1
6692
by: DennisBetten | last post by:
First of all, I need to give some credit to Mahesh Chand for providing me with an excellent basis to export data to excel. What does this code do: As the title says, this code is capable of extracting all tables and it's data from any given database! I was searching the net for a program like this, but I didn't come accross any (free) versions. So I decided to write it myself. To get this code to work, you need to add a reference to...
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9489
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10100
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.