Dim connectionString As String
Dim cnn As SqlClient.SqlConnection
Dim cmd As SqlClient.SqlCommand
Dim sql As String
Dim reader As SqlClient.SqlDataReader
Dim i As Integer = 0
Dim td As DateTime = DateTime.Now
Dim Newdate = td.ToString("yyyy-MM-dd")
connectionString = "Data Source=SQLSERVER\SQLEXPRESS;Initial Catalog=DBName;Persist Security Info=True;User ID=FakeID;Password=FakePassword"
sql = "select CONVERT(VARCHAR(10), AddTime, 120),PatientMRN,PatientName,Checked,Completed from CarePlanOCR where CONVERT(VARCHAR(10), DateColumn, 120) = '" + Newdate + "'" + " order by CONVERT(VARCHAR(10), AddTime, 120)"
cnn = New SqlClient.SqlConnection(connectionString)
Try
cnn.Open()
cmd = New SqlClient.SqlCommand(sql, cnn)
reader = cmd.ExecuteReader()
reader.Read()
While reader.Read()
Dim checkedstate As Integer = reader.Item(3)
'Add based on checked state
If checkedstate = 1 Then
Dim Index As Integer = CheckedListBox1.Items.Add(reader.Item(0) + " - " + reader.Item(1) + " - " + reader.Item(2))
CheckedListBox1.SetItemCheckState(Index, CheckState.Checked)
Else
Dim index As Integer = CheckedListBox1.Items.Add(reader.Item(0) + " - " + reader.Item(1) + " - " + reader.Item(2))
End If
End While
reader.Close()
cmd.Dispose()
cnn.Close()
Catch ex As Exception
MsgBox("Can not open connection ! ")
End Try
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.