K
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=Microsoft.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()
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=Microsoft.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()