dotnet tries to preformat odbc data datetime but fails

R

Roland Wolters

Hi,


I am reading data from a unix odbc datasource in a c# program. Reading the
data as works fine, but one field, contains a date-time format that .net
does not understand.

The query would be: "Select birthdate from <tabel> where bla bla"

We use an odbc command object, and an odbcdatareader.

When I simple execute string result=(string)reader[0]; The .net code tries
to resolve it as a datetime. An error results.

When I try to read the data as bytearray (byte[]) I get the same error.

How can I prevent .net trying to render the data so I can parse it myself?


Greetings,

Roland

--
Roland Wolters
Work : http://www.wolters-ict.net
Private : http://www.habbiebabbie.net
Please reply to newsgroups only. Thanks.

"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
http://www.famousquotes.com/Show.php?_id=1000054
 
J

joris.geysens

Change your query to return the datetime as a string , for example in
Oracle using TO_CHAR.
 
R

Roland Wolters

(e-mail address removed) wrote in @f14g2000cwb.googlegroups.com:
Change your query to return the datetime as a string , for example in
Oracle using TO_CHAR.

Yes, that would be a solution. How ever this is the problem: the database
belongs to a specialized morgage/crm application. The customer wants to
expose some data to the web. The database itself is inexcessible, but there
is a read-only odbc driver, but it's sql syntax is very poor. It was home-
build by de application builder. No luxory there!

Somehow I must be able to access the data in the reader as raw data.


Roland



--
Roland Wolters
Work : http://www.wolters-ict.nl
Private : http://www.habbiebabbie.net
Please reply to newsgroups only. Thanks.

"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
http://www.famousquotes.com/Show.php?_id=1000054
 
C

Christof Nordiek

Did you try following?:
DateTime result = (DateTime)reader[0];

Or try: reader[0].GetType();
Then you at least know wich type you get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top