AndyBrew
3/7/2007 4:26:00 PM
Hi
Firstly I apologise if this is the wrong forum but I couldn't seem to find a
forum dedicated to SqlCe or any other mobile forum other than this one???
Secondly, I have written a data access function that adds a record into a
table into my database for which I have done many others, however this table
has a column of type UniqueIdentifier which allows nulls and the row I am
attempting to add does infact have a null value within this column. The code
I use to add the parameter is: -
obSqlCeParameter = new System.Data.SqlServerCe.SqlCeParameter("@parentguid",
System.Data.SqlDbType.UniqueIdentifier);
obSqlCeParameter.IsNullable = true;
obSqlCeParameter.Value =
Caboodal.MIS.Mobile.Utility.Convert.ToSQLDBGuid(parentguid);
obSqlCeCommand.Parameters.Add(obSqlCeParameter);
This function Caboodal.MIS.Mobile.Utility.Convert.ToSQLDBGuid(parentguid);
simply takes the string representation of my Guid and returns either a
System.Guid type or System.DBNull.Value if the string is in a non valid Guid
format.
After calling the Prepare function an exception is raised which produces the
following message: -
{" [ 1,isnull ]"}
base {System.SystemException}: {" [ 1,isnull ]"}
Errors: {System.Data.SqlServerCe.SqlCeErrorCollection}
errors: {System.Data.SqlServerCe.SqlCeErrorCollection}
HResult: -2147217900
Message: " [ 1,isnull ]"
NativeError: 25922
Source: "SQL Server Compact Edition ADO.NET Data Provider"
I have tried all sorts with regards adding in the value as "" and also as
null in place of the System.DBNull.Value value that I assumed would be
correct as it would in normal ADO.NET.
So how do I add a NULL value as a parameter into my SQL statement?
Thanks in advance
Andy