473,513 Members | 3,949 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Numeric column in Excel

KK
Hi,
Please check the code snippet below. I want the 4th column be numeric.
But, in the result it is always showing as text.
Any suggestions to show this column as numeric?
Thanks.
XLSConn = New ADODB.Connection
XLSConn.Open("Provider=Microso**ft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDestination & _
";Extended Properties=""Excel 8.0;HDR=NO;""")
Dim source As String
Dim arrData
Dim Counter As Integer
source = "Select * from [A6:G6" & "$" & strRecRange &
"]"
XLSrs.Open(source, XLSConn, 1, 3)
arrData = Split(strRec, Chr(9))
For Counter = LBound(arrData) To UBound(arrData) - 1
If Counter = 4 Then 'this column must be integer
XLSrs.Fields(Counter).Value =
Integer.Parse(arrData(Counter)*)
Else
XLSrs.Fields(Counter).Value = Left(arrData(Counter),
255)
End If
Next
XLSrs.Update()
XLSrs.Close()

Nov 13 '05 #1
0 1036

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

Similar topics

4
59401
by: meh | last post by:
I have imported data from excel file. When data came to SQL table, the type of AMOUNT column was varchar. I tried to convert and cast amount type of amount column to number type but it does not allow me to convert. What is the best way of importing data into SQL and type stays the same as it was in excel file ? Or anyone has any better...
3
4523
by: Don.Vonderburg | last post by:
I am having a problem importing an Excel spreadsheet. I have a column in an Excel sheet with alphanumeric text and some of the cells are numeric. Some of the cells contain numbers like 12345.6 and when DTS is done importing it into a field that is nvarchar the results are "12345.600000000001". I have tried: 1. Changing the format of the...
5
1911
by: Colleyville Alan | last post by:
I need to import a spreadsheet into an Access table. The spreadsheet has performance for mutual funds for various periods. The problem is that if there is no info for a particular period, the spreadsheet contains a dash in the cell (for example if the fun is only 4 years old and I look in the columns for 5-year and 10-year performance). I...
1
2293
by: NancyA | last post by:
I am using the following code to write data from a datagrid to an Excel file: Dim tw As New System.IO.StringWriter Dim hw As New System.Web.UI.HtmlTextWriter(tw) dg.RenderControl(hw) Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" Response.AppendHeader("content-disposition", "attachment;filename=test.xls")...
4
2295
by: Bernie Yaeger | last post by:
I use the following writexml method to convert a dataset/datatable to .xml: ds.WriteXml(mstrpath, XmlWriteMode.WriteSchema) ds.WriteXmlSchema(mstrpathxsd) The path strings are simple full paths: eg, f:\emapps\xmlfiles\filename.xml (or .xsd as appropriate). I get an xml file, but there are 2 problems:
5
8927
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column headers). I used ODBC in my VB.NET program to read that spreadsheet into a dataset, to make it easy to manipulate. The code I use to read it is as the...
6
7786
by: Kc-Mass | last post by:
In a standard Ascii table a dash or hyphen is decimal 45. A period or dot is decimal 46. If I sort a table or recordset of mixed character string ascending in Access, those strings beginning with a dot or period are first; those beginning with a dash or hyphen are sorted as though the hyphen is not there (that is the next non-hyphen...
0
1450
by: vbvr | last post by:
I need to export a numeric field (TAX ID) from vb.net to Excel. The value gets converted to Numeric in Excel and leading zeroes are lost. I tried to use code posted on this site. But the style defined here does not get applied in Excel. Following is the sample code. Any suggestions on how to keep the text "02345" in the same format in Excel? ...
0
3209
by: naorem ranjan | last post by:
I have one problem regarding format of mixed data columns in excel. I am using ADO.NET to retrieve data from excel sheet. Connection String used is: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\ITEM.xls;Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1\" I am able to retrieve all data (numeric and text), but for cells...
0
7270
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...
0
7178
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...
0
7397
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7563
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...
1
7125
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...
1
5102
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...
0
4757
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...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.