How insert DBNULL for MYSQL table?

B

Bobby Edward

Latest version of Visual Studio.NET, ASP.NET, MySql, MyDirect.Net
Connector... Using an XSD dataset to access the data and a Business Logic
Layer class to call the queries.

I have a datetime field in a table. Whenever I try to run the INSERT and
leave the datetime blank/null it gives me this error....

System.InvalidCastException: Conversion from string "" to type 'Date' is not
valid.

How do I get around this? I assume it's a property I can set within the XSD
designer (preferred)...
 
A

Alexey Smirnov

Latest version of Visual Studio.NET, ASP.NET, MySql, MyDirect.Net
Connector...  Using an XSD dataset to access the data and a Business Logic
Layer class to call the queries.

I have a datetime field in a table.  Whenever I try to run the INSERT and
leave the datetime blank/null it gives me this error....

System.InvalidCastException: Conversion from string "" to type 'Date' is not
valid.

How do I get around this?  I assume it's a property I can set within the XSD
designer (preferred)...

In schema:
<xs:element name="element_name" type="xs:date" nillable="true"/>

In document:
<element_name xsi:nil="true"/>
 
B

Bobby Edward

But when I pass the date param to the query and the date happens to be "" it
doesn't work even though it's setup to take nulls...

Latest version of Visual Studio.NET, ASP.NET, MySql, MyDirect.Net
Connector... Using an XSD dataset to access the data and a Business Logic
Layer class to call the queries.

I have a datetime field in a table. Whenever I try to run the INSERT and
leave the datetime blank/null it gives me this error....

System.InvalidCastException: Conversion from string "" to type 'Date' is
not
valid.

How do I get around this? I assume it's a property I can set within the
XSD
designer (preferred)...

In schema:
<xs:element name="element_name" type="xs:date" nillable="true"/>

In document:
<element_name xsi:nil="true"/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top