473,226 Members | 1,405 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,226 software developers and data experts.

Problems retreiving a date from MySql

Hi,

I am trying to retreive a record from a MySql table and I get this error
telling :

Unable to convert MySQL date/time value to System.DateTime

I am user the following command:
MySqlDataAdapter.Fill(MydataSet, strTable)

And one of the fields is declared as DateTime.

Can anyone help?

Regards PKin.
--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
5 3483
PKin via DotNetMonster.com wrote:
Hi,

I am trying to retreive a record from a MySql table and I get this error
telling :

Unable to convert MySQL date/time value to System.DateTime

I am user the following command:
MySqlDataAdapter.Fill(MydataSet, strTable)

And one of the fields is declared as DateTime.

Can anyone help?

Regards PKin.


There is a MySQLDataType.MySqlDateTime that you should use instead of
System.DateTime. You can do a MySqlDateTime.DateTime (or might be
GetDateTime can't remember) to get a DateTime object from a mysql
database.

Hope it helps
Chris
Nov 19 '05 #2
Hi Chris,
How can I combine :
MySqlDataAdapter.Fill with MySqlDateTime.GetDateTime.

You see I get the error when I try to fill the dataset. Here is the code

Dim adapter As New MySqlDataAdapter
Dim MydataSet As DataSet = New DataSet
Dim myConnection As New MySqlConnection(myConnString)
<Create the connection string and the query string>

Dim myCommand As New MySqlCommand(StrQuery, myConnection)
myConnection.Open()

adapter.SelectCommand = New MySqlCommand(StrQuery, myConnection)
adapter.Fill(MydataSet, strTable)
<strTable is the name of the table used in the query sting>

Regards
PKin
--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #3
PKin via DotNetMonster.com wrote:
Hi Chris,
How can I combine :
MySqlDataAdapter.Fill with MySqlDateTime.GetDateTime.

You see I get the error when I try to fill the dataset. Here is the code

Dim adapter As New MySqlDataAdapter
Dim MydataSet As DataSet = New DataSet
Dim myConnection As New MySqlConnection(myConnString)
<Create the connection string and the query string>

Dim myCommand As New MySqlCommand(StrQuery, myConnection)
myConnection.Open()

adapter.SelectCommand = New MySqlCommand(StrQuery, myConnection)
adapter.Fill(MydataSet, strTable)
<strTable is the name of the table used in the query sting>

Regards
PKin


I've never done that... I've always used a datareader and loaded up the
datatable myself. Then it really doesn't become an issue.

Sorry
Chris
Nov 19 '05 #4
http://www.google.com/search?sourcei...%2EDateTime%22

I found where the connection string was altered. it is in one of the
first three links, but you may have to follow the thread.

Nov 19 '05 #5
Thanks guys.

That works very nice with the datareader

PKin
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200510/1
Nov 19 '05 #6

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

Similar topics

6
by: carverk | last post by:
Hello All I'm in the middle of moving a MS Access DB to a MySql backend. I have figured out about 90% of the problems I have faced, execpt for this one. I have 3 Queries, which pull records...
1
by: Guy Erez | last post by:
Hi, I'm running queries with MySql 4.0.17 that return thousands of records. Because I need to present them in GUI, I returieve the results in chunks using LIMIT, for example - get first 100,...
0
by: Nico den Boer | last post by:
Hi all, I'm working with: MySql: Database server: mysql-4.1.7-essential-win ODBC driver: MyODBC-3.51.10-x86-win-32bit Administrator: mysql-administrator-1.0.14-win Query browser:...
5
by: Jonathan Crawford | last post by:
Hi I am niew to pho and am having trouble with dates. I can format a date ok so $today=date('d M Y' ) gives me 2 Nov 2005 $dateval is a mysql date
2
by: starfi3ld | last post by:
I got a few errors with this script Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/starfi3ld/domains/starfi3ld.com/public_html/newreleases.php on line...
2
by: David | last post by:
Hi, I am trying to create a simple ASP web counter for my site, but seem to have an error somewhere ??? I am connecting to a MySQL server (works fine) hit-marker = Varchar hit_date = Date...
4
by: pushpinderbagga | last post by:
hi I need help in storing and retreiving hindi text from myql... I have done the folowwing ... mysql_query("SET NAMES 'utf8'"); <META http-equiv=Content-Type content="text/html;...
4
by: atyndall | last post by:
OK, this is the relevant portion script: <?php $username = '__'; // MySQL Database Username. $password = '__'; // MySQL Database Password. $server = '__'; // MySQL Database server (most...
9
by: TC | last post by:
Hi. I have some ASP written in VB.net which is currently installed on a customers server. The asp connects to a local MySql database and retrieves data for the customers customers. If you see...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.