Hola amigos! Tengo varios checkbox en un web form y necesito almacenar los valores de sus etiquetas (Text) en un registro de la bd. Como puedo hacer eso?
Gracias!
| |||
Ok! Observa el codigo: Dim strRecopInformacion As String If ckbRecopInfo.Checked = True Then strRecopInformacion = CType(ckbRecopInfo.Text.ToLower, String) End If Dim strInterpNum As String If ckbInterpNum.Checked = True Then strInterpNum = CType(ckbInterpNum.Text.ToLower, String) End If Dim strJuicio As String If ckbjuicio.Checked = True Then strJuicio = CType(ckbjuicio.Text.ToLower, String) End If Dim strCapCrit As String If ckbcapcrit.Checked = True Then strCapCrit = CType(ckbcapcrit.Text.ToLower, String) End If Dim strCreatividad As String If ckbcreatividad.Checked = True Then strCreatividad = CType(ckbcreatividad.Text.ToLower, String) End If Dim strPerspectiva As String If ckbplanificación.Checked = True Then strPerspectiva = CType(ckbplanificación.Text.ToLower, String) End If Dim strConscOrg As String If ckbconscorg.Checked = True Then strConscOrg = CType(ckbconscorg.Text.ToLower, String) End If Dim strConEnt As String If ckbcondelentorno.Checked = True Then strConEnt = CType(ckbcondelentorno.Text.ToLower, String) End If Dim strOrientacion As String If ckborientaprend.Checked = True Then strOrientacion = CType(ckborientaprend.Text.ToLower, String) End If Dim strAnalProb As String If ckbInterpNum.Checked = True Then strAnalProb = CType(ckbanalproble.Text.ToLower, String) End If Dim strNingunoCompInt As String If ckbninguno.Checked = True Then strNingunoCompInt = CType(ckbninguno.Text.ToLower, String) End If 'Dim strCompIntel As String = strRecopInformacion & "," & strInterpNum & "," & _ 'strCompIntel & "," & "strJuicio & "," & strCapCrit & "," & "," & strPerspectiva & _ 'strConscOrg & "," & strConEnt & "," & strOrientacion & "," & strAnalProb & strNingunoCompInt Tengos todos estos ckeck y necestio almacenar los posibles valores correspondientes a los mismos que puedan ser seleccionados por x usuarios en la BD. Entiendes?...Como puedo hacer eso? Intente declarando una variable de tipo string por cada check y luego anidarlas todas para guardarlas en una sola, pero no me parece la forma más adecuada. Existira una forma más efectiva de hacerlo? |
| ||||
podrías hacerlo de ésta forma: Cita: y con sbSQL.ToString() obtienes todo el textoDim sbSQL As New System.Text.StringBuilder ... ... If ckbRecopInfo.Checked Then sbSQL.Append(ckbRecopInfo.Text.ToLower) End If If ckbInterpNum.Checked Then sbSQL.Append(ckbInterpNum.Text.ToLower) End If If ckbjuicio.Checked Then sbSQL.Append(ckbjuicio.Text.ToLower) End If ... ... por cierto, ya no necesita el casting a string ya que por default Text es un string Salu2
__________________ Nadie roba nada ya que en la vida todo se paga . . . Exentrit - Soluciones SharePoint & Net |