Click here to Skip to main content
15,914,010 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to Refresh a ListBox Contents ? Pin
darkelv24-Jan-08 15:28
darkelv24-Jan-08 15:28 
GeneralOwner draw ListView Pin
N a v a n e e t h24-Jan-08 2:28
N a v a n e e t h24-Jan-08 2:28 
GeneralRe: Owner draw ListView Pin
Vasudevan Deepak Kumar24-Jan-08 4:06
Vasudevan Deepak Kumar24-Jan-08 4:06 
GeneralRe: Owner draw ListView Pin
N a v a n e e t h24-Jan-08 7:40
N a v a n e e t h24-Jan-08 7:40 
GeneralRe: Owner draw ListView Pin
led mike24-Jan-08 4:51
led mike24-Jan-08 4:51 
GeneralRe: Owner draw ListView Pin
N a v a n e e t h24-Jan-08 7:44
N a v a n e e t h24-Jan-08 7:44 
GeneralRe: Owner draw ListView Pin
led mike24-Jan-08 9:33
led mike24-Jan-08 9:33 
GeneralInsert null to an image-data-typed field Pin
DannyAdler24-Jan-08 2:20
DannyAdler24-Jan-08 2:20 
Hi all,

So you have a table "Items" with 2 fields (SQL Server 2000):

Column Datatype Length Allow Nulls
-------------------------------------------
ItemID int 4 0
ItemPicture image 16 1

Now you want to insert a record with the ItemID=1 and with no picture (i.e. null).
So you do this (.NET 2.0):

string strSQL =
"insert into items (ItemID, ItemPicture) values(@ItemID, @ItemPicture)";
SqlCommand cmd = new SqlCommand(strSQL, GetDBConnection());
cmd.Parameters.AddWithValue("@ItemID", "1");
cmd.Parameters.AddWithValue("@ItemPicture", System.DBNull.Value);

if (cmd.Connection.State != ConnectionState.Open)
cmd.Connection.Open();
cmd.ExecuteNonQuery();
if (cmd.Connection.State != ConnectionState.Closed)
cmd.Connection.Close();

And you get an exception: "Operand type clash: nvarchar is incompatible with image".

Question:
So how can you insert a null value to an image field?


Thanks in advance,
Danny
GeneralRe: Insert null to an image-data-typed field Pin
Anthony Mushrow24-Jan-08 2:33
professionalAnthony Mushrow24-Jan-08 2:33 
AnswerRe: Insert null to an image-data-typed field Pin
Guffa24-Jan-08 2:57
Guffa24-Jan-08 2:57 
QuestionSystem tray icon says (# Runs)? Pin
Gene Arnold24-Jan-08 1:48
Gene Arnold24-Jan-08 1:48 
AnswerRe: System tray icon says (# Runs)? Pin
DaveyM6924-Jan-08 2:03
professionalDaveyM6924-Jan-08 2:03 
GeneralRe: System tray icon says (# Runs)? Pin
Gene Arnold24-Jan-08 2:06
Gene Arnold24-Jan-08 2:06 
GeneralRe: System tray icon says (# Runs)? Pin
Luc Pattyn24-Jan-08 2:22
sitebuilderLuc Pattyn24-Jan-08 2:22 
GeneralRefresh a control Pin
kibromg24-Jan-08 1:31
kibromg24-Jan-08 1:31 
GeneralRe: Refresh a control Pin
Anthony Mushrow24-Jan-08 1:33
professionalAnthony Mushrow24-Jan-08 1:33 
GeneralRe: Refresh a control Pin
kibromg24-Jan-08 1:38
kibromg24-Jan-08 1:38 
GeneralRe: Refresh a control Pin
Anthony Mushrow24-Jan-08 1:43
professionalAnthony Mushrow24-Jan-08 1:43 
GeneralRe: Refresh a control Pin
Paddy Boyd24-Jan-08 2:24
Paddy Boyd24-Jan-08 2:24 
QuestionLooking for latest filename Pin
Ofori Boadu24-Jan-08 1:16
Ofori Boadu24-Jan-08 1:16 
GeneralRe: Looking for latest filename Pin
Luc Pattyn24-Jan-08 1:28
sitebuilderLuc Pattyn24-Jan-08 1:28 
QuestionHow to get current date from MonthCalander control??? Pin
Neo Andreson24-Jan-08 0:46
Neo Andreson24-Jan-08 0:46 
AnswerRe: How to get current date from MonthCalander control??? Pin
DaveyM6924-Jan-08 0:53
professionalDaveyM6924-Jan-08 0:53 
Questionhow to block specific url Pin
Tahir Abbasi24-Jan-08 0:29
Tahir Abbasi24-Jan-08 0:29 
AnswerRe: how to block specific url Pin
Anthony Mushrow24-Jan-08 1:06
professionalAnthony Mushrow24-Jan-08 1:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.