Fieldtype = Long, how to set NULL

Fieldtype = Long, how to set NULL

Postby Zero-G. » Sun 21 Jun 2009 15:41

Hey

I am using dotConnect for mySQL 50.20.33.0
In my database, I have two tables, related to each other with an Foreign-Key Reference
Code: Select all
- THIS IS TABLE AUFTRAGDETAILS -

  CONSTRAINT `rel_AuftragDetails_Artikelstamm`
    FOREIGN KEY (`artikelid`)
    REFERENCES `artikelstamm`(ID)
    ON DELETE SET NULL
    ON UPDATE CASCADE

OK - Now, I want to fill the table by code.
By code, I want to add an article, which is not in the parent table. So the ID field has to be NULL.
But I can't give my ID field the value NULL, because the ID field has a type of LONG. And DBNULL.Value can't be set to a value which type is LONG. Also NOTHING is not working, because then has the field a value of 0 and then I get an error from the Server, because I don't hav an article which has 0 as it's ID field.

So the main question now is: How can I set a field which DataType is LONG to DBNULL.Value?

THX[/code]
Zero-G.
 
Posts: 390
Joined: Sat 09 Dec 2006 12:20

Postby Zero-G. » Sun 21 Jun 2009 16:00

OH - Sorry

Found it for my own....
The field, I tried to set as NULL wasn't Nullable declared by me.

THX
Zero-G.
 
Posts: 390
Joined: Sat 09 Dec 2006 12:20


Return to LinqConnect (LINQ to SQL support)