473,323 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

dotnet tries to preformat odbc data datetime but fails

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
Nov 17 '05 #1
4 1572
Change your query to return the datetime as a string , for example in
Oracle using TO_CHAR.

Nov 17 '05 #2
jo***********@gmail.com wrote in news:1127459604.744496.288000
@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
Nov 17 '05 #3
Did you try following?:
DateTime result = (DateTime)reader[0];

Or try: reader[0].GetType();
Then you at least know wich type you get.
Nov 17 '05 #4
Did you try reader.GetString(0) ?

Nov 17 '05 #5

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

Similar topics

0
by: Vic Spainhower | last post by:
Hello, This is probably not the correct forum to post this problem but I posted it in the Access group but didn't get a reply and I'd like to move forward on this. I have setup an ODBC...
1
by: Fons Dijkstra | last post by:
Hello, I'm using the mx.ODBC.Windows package in order to read/write a MSAccess database. Everything works fine apart from the DATE format handling. I'm using the default "datetimeformat" (i.e....
0
by: Marco Aschwanden | last post by:
Hi - Win2000 - Python 2.3.3 - py2exe 0.5.0 - eGenix Comercial & Base Package I am developing an app using mxODBC. On the home page they say ...
1
by: Frank Millman | last post by:
Hi all I am using odbc from win32 extensions to connect to MS SQL Server. I use mx.DateTime to handle dates. When I select a datetime column from the database, odbc returns something called a...
6
by: serge calderara | last post by:
Dear all, Does any one have any idea why an sql statment with INNER JOIN syntax is working well with odbcprovider but not with Oledbprovider when accessing an access 2000 database? here is...
2
by: uli2003wien | last post by:
Dear group, we are dealing with some very specific problems with ODBC, where a connection from SQL-Server to Mysql works with ODBC-driver 3.51.10.00 and does NOT work with ODBC-driver...
3
by: juststarter | last post by:
Hello all, I am executing a stored procedure (on an SQL Server) using ODBC but i can't get the output parameter's value on the client. The stored proc has 3 parameters ,2 of them are input and 1...
14
by: dananrg | last post by:
Been using the ODBC module for Python 2.1 (Win32) and had another question. When I return data from date columns, it's in a strange object form, e.g. <something or other> (don't have the output in...
7
by: Salad | last post by:
I am converting an application from A97 to A2003. I have 2 tables created by another application as a Foxpro.dbf. The table has no index. The connect string in A97 is FoxPro...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.