Free for PREMIUM members
'Use a string variable to hold the ConnectionString.
Dim connectString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\File Databases\NWIND.MDB"
'Create an OleDbConnection object,
'and then pass in the ConnectionString to the constructor.
Dim cn As OleDbConnection = New OleDbConnection(connectString)
'Open the connection.
'Use a variable to hold the SQL statement.
Dim selectString As String = "SELECT ID, dname FROM YourTable"
'Create an OleDbCommand object.
'Notice that this line passes in the SQL statement and the OleDbConnection object.
Dim cmd As OleDbCommand = New OleDbCommand(selectString, cn)
'Send the CommandText to the connection, and then build an OleDbDataReader.
'Note: The OleDbDataReader is forward-only.
Dim reader As OleDbDataReader = cmd.ExecuteReader()
CheckBoxList1.Items.Add(new ListItemreader("dname").ToString(), ListItemreader("ID").ToString())
'Close the reader and the related connection.
Open in new window
' Iterate through the Items collection of the CheckBoxList
' control and display the selected items.
Dim i As Integer
For i=0 To checkboxlist1.Items.Count - 1
If checkboxlist1.Items(i).Selected Then
Message.Text &= checkboxlist1.Items(i).Value & "<br />"
Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.