Hi,
I need to be able to fill a text box with data whenever someone selects a date in the monthly calendar. The Calendar reads the date from a database (im using mySql) and finds the corresponding data to fill, or at least thats how i want it to work!! heres what i have so far, what am i missing?
Private Sub dailyLogDate_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim myData As MySqlDataReader
Dim SQL As String
Dim _date = dailyLogDate.SelectionStart()
Dim notes = dailyLogTxt.Text()
myCommand.Connection = mySqlConn
SQL = "SELECT 'notes' FROM 'daily_log' WHERE _date = '" + _date + "'"
myCommand.Connection = mySqlConn
myCommand.CommandText = SQL
myAdapter.SelectCommand = myCommand
Try
mySqlConn.Open()
myData = myCommand.ExecuteReader()
myData.Read()
mySqlConn.Close()
If myData.HasRows = 0 Then
MsgBox("No Entries Today!.")
myData.Close()
Else
notes = myData.GetString("notes")
myData.Close()
Me.Close()
End If
Catch ex As MySqlException
MsgBox(ex.Message)
End Try
End Sub
I need to be able to fill a text box with data whenever someone selects a date in the monthly calendar. The Calendar reads the date from a database (im using mySql) and finds the corresponding data to fill, or at least thats how i want it to work!! heres what i have so far, what am i missing?
Private Sub dailyLogDate_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim myData As MySqlDataReader
Dim SQL As String
Dim _date = dailyLogDate.SelectionStart()
Dim notes = dailyLogTxt.Text()
myCommand.Connection = mySqlConn
SQL = "SELECT 'notes' FROM 'daily_log' WHERE _date = '" + _date + "'"
myCommand.Connection = mySqlConn
myCommand.CommandText = SQL
myAdapter.SelectCommand = myCommand
Try
mySqlConn.Open()
myData = myCommand.ExecuteReader()
myData.Read()
mySqlConn.Close()
If myData.HasRows = 0 Then
MsgBox("No Entries Today!.")
myData.Close()
Else
notes = myData.GetString("notes")
myData.Close()
Me.Close()
End If
Catch ex As MySqlException
MsgBox(ex.Message)
End Try
End Sub