Hi there,
I have the following INSERT statement:
fieldOne is of type int
fieldTwo is of type date
In MySQL, both are allowed to hold null values.
Now, I try to insert regular data into it:
INSERT INTO myTable (fieldOne,fieldTwo) VALUES(3,'2004-05-18')
NO problem there.
But what is the format for inserting null values?
I tried the following:
nullValue = Nothing
"INSERT INTO myTable (fieldOne,fieldTwo) VALUES(" & nullValue & "," &
nullValue & ")"
I get the following error when I try to submit the query:
ERROR [42000] [MySQL][ODBC 3.51 Driver][mysqld-4.0.18-max-debug]You have
an error in your SQL syntax. Check the manual that corresponds to your
MySQL server version for the right syntax to use near ',,)' at line 1
Thanks in advance! 2 4347
"hellrazor" <jo***@another-world.com> schrieb "INSERT INTO myTable (fieldOne,fieldTwo) VALUES(" & nullValue & "," & nullValue & ")"
"...VALUES (NULL, NULL)..."
But, this question is neither related to ASP.Net, nor to the VB.Net
language. There's an ADO.Net group: microsoft.public.dotnet.framework.adonet
You should consider using the Parameters property of the Command object you
use to execute the Insert statment. You can assign DBNull.Value to the
Parameter value, and the right SQL string is built by the Command object.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"Armin Zingler" <az*******@freenet.de> wrote in
news:40***********************@news.freenet.de: "hellrazor" <jo***@another-world.com> schrieb "INSERT INTO myTable (fieldOne,fieldTwo) VALUES(" & nullValue & "," & nullValue & ")" "...VALUES (NULL, NULL)..."
Thanks. I figured it out right after I posted this. MySql takes care of
it.
But, this question is neither related to ASP.Net, nor to the VB.Net language. There's an ADO.Net group: microsoft.public.dotnet.framework.adonet
right.
You should consider using the Parameters property of the Command object you use to execute the Insert statment. You can assign DBNull.Value to the Parameter value, and the right SQL string is built by the Command object. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mark Davenport |
last post by:
Hi,
Here's my question: How do I pass a NULL value in a variable to a
MySQL DB?
Here's an overview of my problem: I have a PHP page that processes
code, then inserts the code into a database....
|
by: Marcus |
last post by:
Hello, quick question about MySQL storing NULL values...
Say I have a textbox called $_POST and a variable $var.
if(empty($_POST))
$var = NULL;
else
$var = $_POST;
Disregarding...
|
by: Python_it |
last post by:
Python 2.4
MySQL-python.exe-1.2.0.win32-py2.4.zip
How can I insert a NULL value in a table (MySQL-database).
I can't set a var to NULL? Or is there a other possibility?
My var must be variable...
|
by: Rodrigo C. Souza |
last post by:
I need to insert a null value in a table on MS SQL Server 2000 using a stored
procedure.
When I send no data to the stored procedure, I get an error saying that the
value cannot be null, but I did...
|
by: hellrazor |
last post by:
Hi there,
I have the following INSERT statement:
fieldOne is of type int
fieldTwo is of type date
In MySQL, both are allowed to hold null values.
Now, I try to insert regular data into...
|
by: whocracks |
last post by:
hi...
can you tel me how to insert null values in Access table using Vb code....
actually i want to store record having some fields with null values...plz....... i mean error is in query...
|
by: teddysnips |
last post by:
I have an application that does some data manipulation of some tables
to format a table for a report.
1. First I open the table that gives me the parameters for some later
queries
strSQL =...
|
by: praveena mani |
last post by:
Can we insert null values in stored procedures?
When we tried to insert null inprocedures its giving query ok...
But wen we try to display the values from table it shows empty set...
Y???
|
by: rc |
last post by:
How to insert NULL values in to int field using params.
I'm trying to use pymssql.execute, passing the operation and list of
params. One of the values in the params is a NULL value going to int...
|
by: Bigdaddrock |
last post by:
I am attempting to concatenate LName and FName into an expression I will call TelName. If there is no LName, I would like to just have FName appear. If there is no FName I would like just LName to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |