473,659 Members | 2,624 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.Dat aSource = richdb.getTable Data("Select invoiceno,dueda te as string from invoice Where IsCleared = '0' and duedate <= '" & convert.tomysql datenow & "'")

Error: Unable to convert MySQL date/time value to System.DateTime
Feb 1 '08 #1
4 2041
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.f ilter?

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.f ilter?

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 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select database(); +------------+ | database() | +------------+
0
3035
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
23812
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, 12:28 pm EDT This makes them essentially useless for sorting and logical evaluation. Understandbly, the MySQL date functions don't seem able to convert the field to a "real" date field. This yields a blank (or maybe null) "realdate" :
2
13919
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 ( weekstart datetime not null primary key, weekend datetime not null )
4
8628
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 tell me if this is even possible, and if so, how to do it? If this is completely impossible, how would you suggest going about sorting a ComboBox wherein the text displayed in the column is the client's name, and the underlying value is an ID? ...
7
15648
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 there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
4
1950
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 error: Unable to convert MySQL date/time value to System.DateTime Any work around for this? Thanks in advance. ;)
2
1308
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 guess that it may be an environment setting on the other workstation. But how can I make the datagridview display the dates in the same format consistently for all workstations? The data is coming from a sql Server 2000 table. Select * from...
0
2680
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 to type in the date in mysql format to update or insert new records, I want to force the datagridview to display the date column in mysql format for consistency. Heres my code for that: dataGridView1.DataSource = loadData();
0
8428
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
8341
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
8751
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
8539
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
7360
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1739
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.