Hi! I am new to this forum and to programing in visual basic .net! I am sure there is an easy solution but I am stuck!! I have a question:
I have a program with a SQL 2008 backend with a table called p_timesheets inside of which is a field called tsDate stored as date.
I am able to pull the table into a datatable on my timesheet form. I have at the top of my timesheet form, a datetime picker. I need to compare the date selected in the date picker to the datatable and only show the entries that match the date. Here is what I have so far....
Can anyone help me please?!?!?
THANK YOU!!
I have a program with a SQL 2008 backend with a table called p_timesheets inside of which is a field called tsDate stored as date.
I am able to pull the table into a datatable on my timesheet form. I have at the top of my timesheet form, a datetime picker. I need to compare the date selected in the date picker to the datatable and only show the entries that match the date. Here is what I have so far....
VB.NET:
'Create Connection
Dim sqlConn As New SqlConnection()
sqlConn.ConnectionString = ("SERVER=XXXXX; DATABASE=XXXXX; Integrated Security=True")
Try
sqlConn.Open()
Catch sqlError As Exception
MessageBox.Show(sqlError.Message, "Connection Error")
End Try
If sqlConn.state = 1 Then
Me.Text = "Connected!"
End If
Dim sqlComm As New SqlCommand
Dim DTselectdate As Date
DTselectdate = DteTimesheetDate.Text
sqlComm.Connection = sqlConn
'Create DataTable
sqlComm.CommandText = "select tsdate as Date, starttime as Start_Time, arrivaltime as Arrival_Time, endtime as End_Time, comments as Comments from p_timesheet"
THANK YOU!!