troubleshooting Question

Sending a checkbox value to a stored procedure

Avatar of dswett2
dswett2 asked on
4 Comments1 Solution1312 ViewsLast Modified:
I have a few bit columns in a table in a database. I have a stored procedure in which I pass values to create a record. I represent these bit values as checkboxes on my .aspx page. I'm looking to pass the state of these checkboxes (checked = 1, unchecked = 2) to my storedprocedure.

My existing vb code is below which is passing String values fine. I just need the syntax for the lines: ******DIM checkboxes (cb1, cb2, etc)************ and *******Add cb1, cb2 paremeters******
Dim connectionstring As String = System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
        Dim ObjConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionstring)
        Dim objCmd As SqlCommand = New SqlCommand()
        objCmd.Connection = ObjConn
        Dim codereference As String = txtCodeReference.Text
        Dim description As String = txtDescription.Text
        Dim category As String = txtCategory.Text
******DIM checkboxes (cb1, cb2, etc)************
        objCmd.CommandType = System.Data.CommandType.StoredProcedure
        objCmd.CommandText = "dbo.AddInspectionToPicklist"
        objCmd.Parameters.Add("@codereference", Data.SqlDbType.VarChar).Value = codereference
        objCmd.Parameters.Add("@description", Data.SqlDbType.VarChar).Value = description
        objCmd.Parameters.Add("@category", Data.SqlDbType.VarChar).Value = category
*******Add cb1, cb2 paremeters******

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros