More Group Sites
School Rankings
Jobless Net
Better Home
Enviro++


Help | Subscribe/Unsubscribe | Rules | Other Group Sites: Better Education | Better Education Forum
Welcome Guest Search | Active Topics | Members | Log In | Register

sqlce - how to insert DBNnull into binary column via parameter list Options · View
hong
Posted: Friday, October 15, 2010 11:58:38 AM

Rank: Administration
Groups: Administration

Joined: 11/23/2008
Posts: 335
Points: 711
Location: Australia
sqlce - how to insert DBNnull into binary column via parameter list

The table was created using the following script:
Code:
CREATE TABLE [USERS] (
[USER_PASSWORD] binary(100) NULL
);


The SqlCeCommand command text:
Code:
INSERT INTO [USERS]
           ([PASSWORD])
     VALUES
           (@password);



Add the parameter:
Code:
command.Parameters.Add("@password", SqlDbType.Binary).Value = DBNull.Value;


This code works. Once I executed the command and get the error "Value was either too large or too small for an unsigned byte."

I thought it might be this column even though I couldn't figure out anything else wrong. But later I found the error was caused by another column.

Sponsor
Posted: Friday, October 15, 2010 11:58:38 AM
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

ASPNET Theme created by Boskone (Dan Ferguson)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.
This page was generated in 0.267 seconds.