D
Dave Anderson
[This question is directed at Bob Barrows, but perhaps someone else knows an
answer. In any case it is good information for the group.]
I really like Bob's "stored procedure as method of Connection Object"
technique. It is convenient, compact, and concise, and simplifies protection
from SQL injection.
HOWEVER, I cannot figure out a way to pass a null value to an INT parameter
when I use this. Null string parameters are fine. The error reads:
Microsoft OLE DB Provider for SQL Server error '80040e07'
Operand type clash: text is incompatible with int
As you can imagine, "text is incompatible with int" gets my attention. I am
explicitly passing a null (not the string "null"). I am using JScript on the
web server and connecting to SQL Server 2000. An example:
var CN = Server.CreateObject("ADODB.Connection"),
PCTagNumber = +Request.Form("PCTagNumber").Item || null,
DeskLocation = Request.Form("DeskLocation").Item || null
CN.Open(CNString)
CN.Inventory_Update(HR.UserID,PCTagNumber,DeskLocation)
Assume the stored procedure looks something like:
CREATE PROCEDURE dbo.Inventory_Update(
@UserID VARCHAR(50),
@TagNumber INT,
@DeskLocation VARCHAR(255)
) AS ...
In the above case, a null tag number produces the error, while a null desk
location results in a SQL NULL passed to the parameter @DeskLocation.
Is there a way for me to pass a null integer here, or is this a limitation
of Bob's technique?
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
answer. In any case it is good information for the group.]
I really like Bob's "stored procedure as method of Connection Object"
technique. It is convenient, compact, and concise, and simplifies protection
from SQL injection.
HOWEVER, I cannot figure out a way to pass a null value to an INT parameter
when I use this. Null string parameters are fine. The error reads:
Microsoft OLE DB Provider for SQL Server error '80040e07'
Operand type clash: text is incompatible with int
As you can imagine, "text is incompatible with int" gets my attention. I am
explicitly passing a null (not the string "null"). I am using JScript on the
web server and connecting to SQL Server 2000. An example:
var CN = Server.CreateObject("ADODB.Connection"),
PCTagNumber = +Request.Form("PCTagNumber").Item || null,
DeskLocation = Request.Form("DeskLocation").Item || null
CN.Open(CNString)
CN.Inventory_Update(HR.UserID,PCTagNumber,DeskLocation)
Assume the stored procedure looks something like:
CREATE PROCEDURE dbo.Inventory_Update(
@UserID VARCHAR(50),
@TagNumber INT,
@DeskLocation VARCHAR(255)
) AS ...
In the above case, a null tag number produces the error, while a null desk
location results in a SQL NULL passed to the parameter @DeskLocation.
Is there a way for me to pass a null integer here, or is this a limitation
of Bob's technique?
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.