?
Solved

Trying to save data type NULL or integer in parameterized query

Posted on 2013-06-02
6
Medium Priority
?
307 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:Meir Rivkin
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 49

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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

809 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