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

Posted on 2007-09-28
Last Modified: 2013-11-25
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

I am lost, help me. Thank you.
Question by:erin027
    LVL 23

    Expert Comment

    by:Ashish Patel
    .Parameters.Append .CreateParameter("@newsletter", adInteger, adParamInput)
    LVL 23

    Accepted Solution

    Use this
    .Parameters.Append .CreateParameter("@newsletter", 11, adParamInput)
    LVL 23

    Expert Comment

    by:Ashish Patel
    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
    LVL 14

    Expert Comment

    bit when passing thru ASP is meerly an integer ...1 or you can use integer as your paramter data type...
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    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...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    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.

    I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
    Viewers will learn how the fundamental information of how to create a table.

    779 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

    14 Experts available now in Live!

    Get 1:1 Help Now