all groups > dotnet windows forms databinding > september 2006 >
You're in the

dotnet windows forms databinding

group:

For columns not defined as System.String, the only valid value is (Throw exception).



Re: For columns not defined as System.String, the only valid value is (Throw exception). Steven Nagy
9/25/2006 2:01:33 PM
dotnet windows forms databinding: Hi Rob,

First, can we see the code where you are assigning your null to your
datarow?
Secondly, is the dataset a 'typed' dataset?
And finally, what database are you using?

Cheers,
Steven
Re: For columns not defined as System.String, the only valid value is (Throw exception). Mel
9/25/2006 4:26:16 PM
I set it using parameters, something like


using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "Update Policys set ExpDate = @ExpDate where
primaryKey = @primaryKey";
cmd.Parameters.Add("@ExpDate", SqlDbType.DateTime).Value = DBNull.Value;
cmd.Parameters.Add("@primaryKey", SqlDbType.Int).Value = 100;
}

[quoted text, click to view]

For columns not defined as System.String, the only valid value is (Throw exception). Rob Dob
9/25/2006 4:39:08 PM
I am trying to set the NullValue within the Column properties of my Dataset
in VS2005. The DataType is a System.DateTime. and when I try and change it
from "(Throw Exception)" I get the following error:

For columns not defined as System.String, the only valid value is (Throw
exception).

The Datafield is a datetime that allows nulls, if I don't set this value
then when I try save changes to this field within my form I get it
complaining about not allowing DBNull for that field..



I am also having this same problem with DataType int where I also allow
nulls



any help would be appreciated.,

Re: For columns not defined as System.String, the only valid value is (Throw exception). Rob Dob
9/25/2006 5:22:15 PM
Hi,

I have a DateTimePicker Databound to Dataset datacolumn whicc allow =
nulls:

And before I call update on my tableadapter I do something like: where ( =
ordersCustomersRow ) is a view of two combined tables.
ordersRow.Permit_Date =3D ordersCustomersRow.Permit_Date;

Re: For columns not defined as System.String, the only valid value is (Throw exception). Rob Dob
9/25/2006 5:35:36 PM

Hi,

[quoted text, click to view]

I would prefer to just set the value within my strongly typed dataset before
I call its TableAdaptersUpdate(), is this possible?

Thanks,

AddThis Social Bookmark Button