[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Error Storing NULL Values in mySQL from VB6

Asked by rpotash in VB Database Programming, Microsoft Access Database, MySQL Server

Tags: VB6 NULL Update Error mySQL Date Field

I have found two issues when trying to store NULL values in mySQL with an ADO recordset.

1 .RS vs. Execute Updates
rs!DateField = NULL            ' 'Error Reported on .Update
connection.execute UPATE Table SET DateField=NULL     ' Works correctly.

Is there a difference between VB NULL and the NULL executed in an SQL Statement?

2. I have an Infragistics Date control bound to a date field. Connecting to Access if there is a valid date in the database and I then delete the date from the bound control and do a .update, NULL is stored in the database as expected. In mySQL and invalid date value (something like '0016-00-00 00:2009') is stored. The very strange part is that if I add the following statement (where I touch a memo type field) before the .update NULL is correctly stored under mySQL and no error is reported.

rs!MemoField = rs!MemoField
.update

Can someone explain this? For now I unhooked the data controls and use a loop which spins through the controls on the form an manually updates the database. I'd rather bind the controls but don't want to go forward this a "fix" which I can't explain.

Thanks,
Rich...
[+][-]10/24/09 08:19 AM, ID: 25652591Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/24/09 08:52 AM, ID: 25652717Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/20/09 07:59 AM, ID: 25871519Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625