Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / March 2008

Tip: Looking for answers? Try searching our database.

Update query that won't take DBNull

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
michael - 25 Mar 2008 21:21 GMT
I have a stored procedure that I let the wizard create a function in the
QueriesTableAdapter class. Some of the parameters to the stored procedure
clearly allow for nulls (AllowDBNull) but somehow the wizard refused to add
the Global.System.Nullable(Of String) to the generated function's parameter
list. Now I can't use the function if the parameter is DBNull.Value. Can I go
and edit the Designer.vb manually or is there a way to cause the wizard to
recognize that the function should make the parameter Nullable(Of Type)?

Signature

Michael

michael - 25 Mar 2008 22:12 GMT
OK. I must repent for being a bozo. First, when the Type is String, you can't
place it in Nullable(Of Type). This is for Value Types only. If you need to
make the value null, use Nothing.

Now, had I been using an actual SQLParameter, I could have assigned the
.value to DBNull.value

Signature

Michael

> I have a stored procedure that I let the wizard create a function in the
> QueriesTableAdapter class. Some of the parameters to the stored procedure
[quoted text clipped - 3 lines]
> and edit the Designer.vb manually or is there a way to cause the wizard to
> recognize that the function should make the parameter Nullable(Of Type)?
Cor Ligthert[MVP] - 26 Mar 2008 06:12 GMT
Michael,

DBNull.Value is a value type
Nullable(Of Type) has a value type that is not the DBNull.Value

If you want to set a value type Null in SQL Server, you have to tell that
the value you are delivering is a Data Base Null. Value (type).

Cor

> OK. I must repent for being a bozo. First, when the Type is String, you
> can't
[quoted text clipped - 16 lines]
>> to
>> recognize that the function should make the parameter Nullable(Of Type)?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.