ExecuteCommand empty parameter error
Posted: Thu 05 Aug 2010 13:21
Hello,
I am using dotConnect SQLite professional (version 2.90.146.0).
The problem occurs when i am using ExecuteCommand on the sqlite context where a parameter contains an emtpy string.
In this case, the parameter value is simply gone, and the value of the next parameter takes its place, shifting all paramters after it to the left.
The error does not occur if i replace the empty strings with a blank.
A small example, maybe this helps to reproduce it on your side:
The table, nothing fancy
Some sample code how i fill the table (sqliteContext is the datacontext for the sqlite db file):
The date ends up in the DATA3 string instead of in DATA4. The DATA4 and DATA5 values are empty as well.
I am using dotConnect SQLite professional (version 2.90.146.0).
The problem occurs when i am using ExecuteCommand on the sqlite context where a parameter contains an emtpy string.
In this case, the parameter value is simply gone, and the value of the next parameter takes its place, shifting all paramters after it to the left.
The error does not occur if i replace the empty strings with a blank.
A small example, maybe this helps to reproduce it on your side:
The table, nothing fancy
Code: Select all
CREATE TABLE MYTABLE (
UID NVARCHAR(36) NOT NULL PRIMARY KEY,
DATA1 INT NULL,
DATA2 INT NULL,
DATA3 NVARCHAR(128) NULL,
DATA4 DATETIME NULL,
DATA5 NVARCHAR(128) NULL
);
Code: Select all
string sqlCommand = "INSERT INTO MYTABLE (UID, DATA1, DATA2, DATA3, DATA4, DATA5) VALUES ({0}, {1}, {2}, {3}, {4}, {5});";
sqliteContext.ExecuteCommand( sqlCommand,
Guid.NewGuid().ToString(),
0,
1,
string.Empty, // if I use some replacement string like " " then it works
DateTime.UtcNow,
"SomeText");