473,699 Members | 2,226 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1592
Change your query to return the datetime as a string , for example in
Oracle using TO_CHAR.

Nov 17 '05 #2
jo***********@g mail.com wrote in news:1127459604 .744496.288000
@f14g2000cwb.go oglegroups.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)reade r[0];

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

Nov 17 '05 #5

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

Similar topics

0
2029
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 Connection to a MySQL database (driver version is 3.51) but when I setup the link in MS Access 2002 some of the tables will show #Name? in all of the fields, some will show #Deleted in all of the fields and some will work (except I can't update them). ...
1
3288
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. DATETIME_DATETIMEFORMAT) as suggested. The date columns in the MSAccess database have "Short Date" format. When I read a DATE item everything works fine, like:
0
2241
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 http://www.egenix.com/files/python/mxODBC.html#Hints
1
3270
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 DbiDate object. I cannot find out any information on this type, but mx can convert it to a mx.DateTime object using DateTimeFrom(), which is really all that I need. I am looking into changing from mx.DateTime to using the builtin
6
2677
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 the code I have used with oledbprovider which fails Dim monodbc As New OleDb.OleDbConnection 'Odbc.OdbcConnection
2
2244
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.51.11.00. Maybe someone experiences similar problems or even has a solution ? Some feedback (to the group) would be highly appreciated. We use a Microsoft SQL-Server as Headquarter database and some Mysql-machines on Redhat as satellite-databases. We...
3
4605
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 is output. (for shake of simplicity let's suppose that the proc seems something like -------------------------------------------------------------------- alter storedProcsName @inputParam1 varchar(20), @inputParam2 varchar(20), @outputParam...
14
1781
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 front of me>. What's an easy way to convert date objects into a human-readable string? I'm using this module to extract data from an Oracle database, then converting it to a flat-file for import into an old flat-file database on a mainframe. I...
7
3058
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 2.0;HDR=NO;IMEX=2;DATABASE=C:\Test It's really easy to connect to those tables in A97. I'm having difficulties in A2003. I'm trying to follow the instructions in http://support.microsoft.com/kb/824264/.
0
8689
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8618
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9178
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9035
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8916
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.