Forum Moderators: open

Message Too Old, No Replies

Inserting DBNull with asp.net

         

Jimmy Turnip

11:33 am on Jun 18, 2004 (gmt 0)

10+ Year Member



I'm trying to replace a field with a specific value with a dbnull value with the following sql statement:

"UPDATE MyDBTable SET ID = " & DBNull.Value & " WHERE ID = " & MyDropDownList.SelectedValue & ";"

I keep receiving the error "Incorrect syntax near the word WHERE"

Anyone got any ideas what I am doing wrong?

Thanks.

duckhunter

12:50 pm on Jun 18, 2004 (gmt 0)

10+ Year Member



Just use the word NULL inside the quotes.

"UPDATE MyDBTable SET ID = NULL WHERE ID = " & MyDropDownList.SelectedValue & ";"

Jimmy Turnip

1:00 pm on Jun 18, 2004 (gmt 0)

10+ Year Member



thanks. now i feel stupid.