Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Store and read the Checkbox "Checked" value

Status
Not open for further replies.

lunargirrl

Programmer
Jan 26, 2004
77
BR
Hi people :)
How can I store and read the Checkbox "Checked" value to and from a table in my database?

TIA,
Gis.
 
I use stored procedures and the db field is a BIT field...
to set to parameter value...

Code:
Dim closed As SqlParameter = New SqlParameter("@CLOSED", CBool(Me.chkClosed.Checked))

sqlCommand.Parameters.Add(closed)

to retrieve as DB BIT

Code:
Me.chkClosed.Checked = CBool(DataBinder.Eval(dsClient, "Tables[CLT].defaultView.[0].CLOSED"))
 
I am not using parameters, had to carry on a project of another person that uses instead of parameters, the name of the textboxes or session variables:
example of an insert command that i am using:

strSql = "INSERT INTO T_WEB_AUDITORIA_USUARIO_ACOES (COD_USUARIO, DAT_ACESSO) " & _
"VALUES ('" & strCod_Usuario & "', '" & strdatacesso & "')"

objBanco.InserirDados(strsql, enuTipoBanco.Web)

I have 10 checkboxes, for each one I set a value between 1 to 10.

Up to now I made this :
Me.chkFichaAcionamento.Attributes.Add("Valor", 1)
Me.chkAnalContratos.Attributes.Add("Valor", 2)
Me.chkMapaProducao.Attributes.Add("Valor", 3)
Me.chkPosCarteira.Attributes.Add("Valor", 4)
Me.chkBolFuturos.Attributes.Add("Valor", 5)
Me.chkPrestContas.Attributes.Add("Valor", 6)
Me.chkDiarioCraga.Attributes.Add("Valor", 7)
Me.chkGravacoes.Attributes.Add("Valor", 8)
Me.chkCadUsuarios.Attributes.Add("Valor", 9)
Me.chkGerUsuarios.Attributes.Add("Valor", 10)

But I dont know how to pass this collection of numbers to my strsql. ???

Thanks checkai, glad if you or another person could help me more.
Gis.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top