H
Hollywood
Note: I posted it in the sqlserver.ce newsgroup initially, but the CF
newsgroup always seemed to get more traffic and such questions had been
answered in the past..... so, I'll see if anyone has a thought!
I'm attempting to use a SqlCeCommand with parameters to insert some strings
into a table. However, while it inserts a new row into the table, it does
not insert any of the strings into the table, but all the other values are
properly inserted. Would post code, but its long and involved, but I do
something of the sort:
sqlCmd.Parameters.Add("@Id", SqlDbType.UniqueIndentifier);
sqlCmd.Parameters.Add("@IntTest", SqlDbType.Int);
sqlCmd.Parameters.Add("@NVarTest", SqlDbType.NVarChar);
sqlCmd.Parameters.Add("@NTextTest", SqlDbType.NText);
sqlCmd.CommandText = "INSERT INTO tTest (Id, IntTest, NVarTest, NTextTest)
VALUES (?, ?, ?, ?)";
sqlCmd.Prepare();
sqlCmd.Parameters[0].Value = new Guid();
sqlCmd.Parameters[1].Value = 99;
sqlCmd.Parameters[2].Value = "Test";
sqlCmd.Parameters[3].Value = "Test2";
sqlCmd.ExecuteNonQuery();
And here is the table:
CREATE TABLE tTest (Id uniqueidentifier Primary Key NOT NULL,
IntTest int NOT NULL,
NVarTest nvarchar(20) NOT NULL,
NTextTest ntext NOT NULL)
However, this fails to insert both "Test" and "Test2" into the table.
Thoughts?
newsgroup always seemed to get more traffic and such questions had been
answered in the past..... so, I'll see if anyone has a thought!
I'm attempting to use a SqlCeCommand with parameters to insert some strings
into a table. However, while it inserts a new row into the table, it does
not insert any of the strings into the table, but all the other values are
properly inserted. Would post code, but its long and involved, but I do
something of the sort:
sqlCmd.Parameters.Add("@Id", SqlDbType.UniqueIndentifier);
sqlCmd.Parameters.Add("@IntTest", SqlDbType.Int);
sqlCmd.Parameters.Add("@NVarTest", SqlDbType.NVarChar);
sqlCmd.Parameters.Add("@NTextTest", SqlDbType.NText);
sqlCmd.CommandText = "INSERT INTO tTest (Id, IntTest, NVarTest, NTextTest)
VALUES (?, ?, ?, ?)";
sqlCmd.Prepare();
sqlCmd.Parameters[0].Value = new Guid();
sqlCmd.Parameters[1].Value = 99;
sqlCmd.Parameters[2].Value = "Test";
sqlCmd.Parameters[3].Value = "Test2";
sqlCmd.ExecuteNonQuery();
And here is the table:
CREATE TABLE tTest (Id uniqueidentifier Primary Key NOT NULL,
IntTest int NOT NULL,
NVarTest nvarchar(20) NOT NULL,
NTextTest ntext NOT NULL)
However, this fails to insert both "Test" and "Test2" into the table.
Thoughts?