Hi friends
I have created a list of checkboxes and list of textboxes by using two control arrays. Now i want to send only selected checkbox lables and textbox values to a access 2003 database table with two data fields.
I have coded to create OleDbDataConnection and OleDbDataCommand connections.
This is my code set:
Dim cnn1 As New System.Data.OleDb.OleDbConnection
Dim cmd1 As New System.Data.OleDb.OleDbCommand
cnn1 = ConnectToNW()
cnn1.Open()
cmd1.Connection = cnn1
Dim a As Integer
Dim d As Boolean = False
Dim frm6 As New Form6
For a = 0 To 59
While (chkBox(a).Checked = True)
d = True
Exit While
End While
Next a
If d = True Then
For a = 0 To 59
If chkBox(a).Checked = True Then
cmd1.CommandText = "INSERT INTO Selected (Ingredient_Name, Price) & Values (chkbox(a).text & txtTextboxArray.text)"
cmd1.ExecuteNonQuery()
End If
Next
cnn1.Close()
Else
MsgBox("Sorry!, please select ingredients and enter their prices", MsgBoxStyle.Critical, "Invalid Selection!")
End If
This is not working. The compiler stops at the first EndIf.
How can i sole this problem?
Thanks
I have created a list of checkboxes and list of textboxes by using two control arrays. Now i want to send only selected checkbox lables and textbox values to a access 2003 database table with two data fields.
I have coded to create OleDbDataConnection and OleDbDataCommand connections.
This is my code set:
Dim cnn1 As New System.Data.OleDb.OleDbConnection
Dim cmd1 As New System.Data.OleDb.OleDbCommand
cnn1 = ConnectToNW()
cnn1.Open()
cmd1.Connection = cnn1
Dim a As Integer
Dim d As Boolean = False
Dim frm6 As New Form6
For a = 0 To 59
While (chkBox(a).Checked = True)
d = True
Exit While
End While
Next a
If d = True Then
For a = 0 To 59
If chkBox(a).Checked = True Then
cmd1.CommandText = "INSERT INTO Selected (Ingredient_Name, Price) & Values (chkbox(a).text & txtTextboxArray.text)"
cmd1.ExecuteNonQuery()
End If
Next
cnn1.Close()
Else
MsgBox("Sorry!, please select ingredients and enter their prices", MsgBoxStyle.Critical, "Invalid Selection!")
End If
This is not working. The compiler stops at the first EndIf.
How can i sole this problem?
Thanks
Last edited: