• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2089
  • 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.
0
erin027
Asked:
erin027
  • 3
1 Solution
 
Ashish PatelCommented:
.Parameters.Append .CreateParameter("@newsletter", adInteger, adParamInput)
0
 
Ashish PatelCommented:
Use this
.Parameters.Append .CreateParameter("@newsletter", 11, adParamInput)
0
 
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)

cmd.Execute
errNum = cmd("errNum")
set cmd = nothing
0
 
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...
0
 
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...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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