473,508 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error on datagridview date field using mysql and vb2005

13 New Member
Well, the app im working on makes an error when trying to populate a datagridview when the source contains date field. Any solution to my problem?


dgvInvoices.DataSource = richdb.getTableData("Select invoiceno,duedate as string from invoice Where IsCleared = '0' and duedate <= '" & convert.tomysqldatenow & "'")

Error: Unable to convert MySQL date/time value to System.DateTime
Feb 1 '08 #1
4 2034
daniel aristidou
491 Contributor
Well, the app im working on makes an error when trying to populate a datagridview when the source contains date field. Any solution to my problem?
Error: Unable to convert MySQL date/time value to System.DateTime
Try this....
Expand|Select|Wrap|Line Numbers
  1. Bindingsource.filter = "Iscleared = '0'" "and duedate <= '" & now & "'"
Feb 1 '08 #2
thelner
13 New Member
Thanks but a complete noob here. :)

Where should i place the bindingsource.filter?

Will it allow me to display mysql dates on the datagridview w/o the error?
Feb 1 '08 #3
daniel aristidou
491 Contributor
Where should i place the bindingsource.filter?

Will it allow me to display mysql dates on the datagridview w/o the error?
Well that depends on you....do you want the datagrid to always only display the corresponding records?
if so.. put it under form_load
else create a command button ..and put it under
commandbotton1_click
I think it will sove your problem...no promises though...if it does not solve the problem...im still around...
Feb 1 '08 #4
thelner
13 New Member
Still wont work. Has the same error. I think the error is generated because .net cant display on a datagridview tables that has a diiferent format date field. Is there a way so that .net will interpret mysql date tables as strings?

Expand|Select|Wrap|Line Numbers
  1.         Public Sub refreshinvoices()
  2.         Dim source As New BindingSource
  3.         richdb.connectRichDB() 'opens mysql connection
  4.         source.DataSource = richdb.getTableData("Select * from invoice") 'binds invoice table to bindingsource
  5.         source.Filter = "IsCleared = '0'" 'selects uncleared invoices
  6.         dgvInvoices.DataSource = source
  7.         richdb.disconnectRichDB() 'closes connection
  8. End Sub
Feb 3 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1193
by: Morten Gulbrandsen | last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug Type...
0
3026
by: Morten Gulbrandsen | last post by:
mysql> USE company; Database changed mysql> mysql> DROP TABLE IF EXISTS EMPLOYEE; -------------- DROP TABLE IF EXISTS EMPLOYEE -------------- Query OK, 0 rows affected (0.00 sec)
3
23798
by: usenet | last post by:
I have inherited a table where date information was saved from PHP as a VARCHAR. (Sigh.) This means that the so-called date fields look like this : August 1, 2005, 9:09 am EDT October 13, 2004,...
2
13910
by: Alicia | last post by:
Does anyone know why I am getting a "Syntax error in Create Table statement". I am using Microsoft Access SQL View to enter it. Any other problems I may run into? CREATE TABLE weeks (...
4
8609
by: Matt | last post by:
I have been searching all over the web for a way to sort a DataGridView based on the actual text being shown in a ComboBox column as opposed to the underlying value (an ID in this case). Can anyone...
7
15612
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
4
1939
by: thelner | last post by:
Im trying to bind a table in mysql containing a mysql date field in a datagridview in vb.net 05. When i only select fields containing non-dates it works, but once i add a date field it generates this...
2
1304
by: =?Utf-8?B?UmljaA==?= | last post by:
Using VB2005, a datagridview is displaying the dates with 4 digit years on one workstation but displays the dates of the exact same records with only 2 digit years on a 2nd workstation. I will...
0
2645
by: modolamara | last post by:
Hi people, im importing a date column from a mysql database to a datagridview but it automatically changes the date format from 'YYYY-MM-DD' (Mysql format) to 'MM/DD/YYYY' since the user has...
0
7118
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...
1
7038
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...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
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...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
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 ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.