Hi Adrian,
You can get the data type by calling GetType() on an object. For example,
you can use datareader["column"].GetType() to get the type of the value in
the column.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
--------------------
| From: "Adrian Parker" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
<#
[email protected]>
<
[email protected]>
| Subject: Re: formatted numbers returned when they should not be.
| Date: Fri, 7 Nov 2003 08:21:47 -0000
| Lines: 69
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: 82-37-130-6.cable.ubr01.telf.blueyonder.co.uk
82.37.130.6
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:65729
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Ach! ok, so we will have to rewrite it all, given we were relying on cstr
| returing an already truncated string when dealing with fields of unknwon
| datatype. Is there any way of determining the datatype of a resultset
column
| in an oldbdatareader ?
|
| -Adrian
|
| > Hi Adrian,
| >
| > The behavior of Cstr() has changed a bit from VS .net 2002 to VS .net
2003.
| > You can resolve this by using the following code:
| >
| > dim s as single = reader.Item("numeric_column_name")
| > lstr_val = Cstr(s)
| >
| > This works both in 2002 and 2003.
| >
| > Kevin Yu
| > =======
| > "This posting is provided "AS IS" with no warranties, and confers no
| > rights."
| >
| > --------------------
| > | From: "Adrian Parker" <
[email protected]>
| > | References: <
[email protected]>
| > <
[email protected]>
| > | Subject: Re: formatted numbers returned when they should not be.
| > | Date: Thu, 6 Nov 2003 06:53:54 -0000
| > | Lines: 19
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <#
[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.adonet
| > | NNTP-Posting-Host: 82-37-130-6.cable.ubr01.telf.blueyonder.co.uk
| > 82.37.130.6
| > | Path:
| >
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
| > phx.gbl!TK2MSFTNGP11.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.adonet:65590
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| > |
| > | No, the problem is that they seem to have changed how it works between
| > framework 1.0 and 1.1.
| > |
| > | > | > 1) You have the column numeric scale and precision that is
responsible
| > | > for the return value
| > | > 2) You are retrieving it after converting it to str this is the
complete
| > | > issue...
| > | >
| > | > Store it in a int or number variable... it would resolve ur issue.
| > | >
| > | >
| > | > Keyur Shah
| > | > Verizon Communications
| > | > 732-423-0745
| > | >
| > | >
| > | > Don't just participate in USENET...get rewarded for it!
| > |
| > |
| > |
| >
|
|
|