Solved

Trying to save data type NULL or integer in parameterized query

Posted on 2013-06-02
6
252 Views
Last Modified: 2013-06-02
Hi,

Here is my code. http://screencast.com/t/DSMCoDDc  I added the last optional parameter for 'review status'  and have two sub routine calls  that call this save routine.  The first, where I specify the 'review status' as one, we are all good and the record is created just fine, however when I use the second sub routine  call and 'Nothing" I get the error you see in the screenshot.  So what am I not getting

Thanks in advance!!
0
Comment
Question by:bluetundra
  • 3
  • 2
6 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39214227
on line 326, change @fkid_letter to @reviewed as the parameter name.
0
 

Author Comment

by:bluetundra
ID: 39214242
well that prevented the exception from firing but the record doesn't save to the DB if you look here http://screencast.com/t/YFvdJYY5 you see that 'reviewed' is 0 but when I call the routine I pass 'Nothing'.  Hmm?  Thanks
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 39214274
on line 312 you are still referring to fkid_letter, just before the word values

fkid_letter) values (@address

try this as:

reviewed) values (@address
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39214383
check lines 320 and 326, they both should be @reviewed.
0
 

Author Comment

by:bluetundra
ID: 39214433
I'm not sure 312 should be 'reviewed'  Here is another screenshot but this time with the DB so you can see the column names.  No exception but it's still not saving.  I think I've implemented the last coment  http://screencast.com/t/XPrLMNTdQM
0
 

Author Comment

by:bluetundra
ID: 39214572
Hey Thanks both of you for helping me.  

I stumbled upon this link http://bytes.com/topic/visual-basic-net/answers/350316-how-can-integer-contain-null-value and reintroduced mself to the 'Object' data type.  

What was happening once my parameters were cleaned up is that when you assign an integer Nothing it renders as 0 but we wanted it to be DBNULL.Value which I changed as well from 'Nothing' in the calling routine
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now