Hello- okay I'm trying out the formview... with the checkboxlist control, I can response.write the comma delimited string of values which is fine, how can i insert this to my SQL table?
My SQL statement somethig like this:
I know it's simple- just missing something simple...
Code:
Protected Sub InsertButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim FormView As FormView = CType(FormView1, FormView)
Dim cblist As CheckBoxList = CType(FormView.Row.FindControl("HchkEvents"), CheckBoxList)
Dim i
For i = 0 To cblist.Items.Count - 1
If cblist.Items(i).Selected Then
Response.Write(cblist.Items(i).Value.ToString + ",")
End If
Next
End Sub
My SQL statement somethig like this:
Code:
Dim sSql As String
sSQL = "INSERT INTO tblFPCHotel" _
& "(HchkEvents)" _
& "VALUES(what goes here?)"
Dim cmd As New Data.SqlClient.SqlCommand(sSQL)
Dim conn As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
conn.Open()
cmd.Connection = conn
cmd.ExecuteNonQuery()
cmd.Parameters.Clear()
cmd.CommandText = sSQL
conn.Close()
I know it's simple- just missing something simple...