• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2282
  • Last Modified:

[ASP] When creating parameter, how do I write datatype, 'bit'?

I am writing an ASP coding with parameter object.
How do I write datatype 'bit' when creating Parameter?

.Parameters.Append .CreateParameter("@newsletter", adBit,adParamInput)

Do I have to create something on my adovbs.inc?

I am lost, help me. Thank you.
  • 3
1 Solution
Ashish PatelCommented:
.Parameters.Append .CreateParameter("@newsletter", adInteger, adParamInput)
Ashish PatelCommented:
Use this
.Parameters.Append .CreateParameter("@newsletter", 11, adParamInput)
Ashish PatelCommented:
An example for you.
set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = cnn `cnn is the name of my db connection
cmd.CommandText = "spInsertOrder" `name of my sp
cmd.CommandType = adCmdStoredProc `A const that = 4

`parameters are:
` 1) parameter name
` 2) variable type: 3=integer, 200=varchar, 6=money, 11=bit (boolean)
` 3) parameter type: 1=INPUT, 2=OUTPUT, 3=INPUT/OUTPUT
` 4) parameter length
` 5) value

cmd.Parameters.Append = cmd.CreateParameter("seller_company_id`",3,1,,sellingCompanyID)
cmd.Parameters.Append = cmd.CreateParameter("realm_id",3,1,,session("realmID"))
cmd.Parameters.Append = cmd.CreateParameter("cust_id",3,1,,custID)
cmd.Parameters.Append = cmd.CreateParameter("handling",6,1,,repZero(handling_charge))
cmd.Parameters.Append = cmd.CreateParameter("tax",6,1,,repZero(Request.Form("taxTotal")))
cmd.Parameters.Append = cmd.CreateParameter("pending_code",11,1,,pendingCode)
cmd.Parameters.Append = cmd.CreateParameter("order_id",200,1,50,newOrderID)
cmd.Parameters.Append = cmd.CreateParameter("errNum",3,3,,null)

errNum = cmd("errNum")
set cmd = nothing
Jai STech ArchCommented:
bit when passing thru ASP is meerly an integer ...1 or 0...so you can use integer as your paramter data type...
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I have to agree with asvforce, the value 11 (which corresponds to the adBoolean enum) is what should be used for the bit data type.
although, adInteger should also work...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now