sqlcon = New MySqlConnection
    sqlcon.ConnectionString = "server=localhost;userid=root;password=soumya;database=bams;"
    Dim da, da1 As MySqlDataAdapter
    Dim ds, ds1 As New DataSet
    Dim attendedclass, noofclass As Integer
    Dim query, query1 As String
    Dim yr, mon, day, yr1, mon1, day1 As Integer
    yr = DateTimePicker1.Value.Year
    yr1 = DateTimePicker2.Value.Year
    day = DateTimePicker1.Value.Day
    day1 = DateTimePicker2.Value.Day
    mon = DateTimePicker1.Value.Month
    mon1 = DateTimePicker2.Value.Month
    sqlcon.Open()
    query1 = "select * from attendence_master where ( REGISTER_NO='" & TextBox1.Text & "' ) and ( SUBJECT='" & ComboBox1.SelectedItem.ToString() & "' ) and ( LECTURER_NAME='" & TextBox4.Text & "' ) and ( CLASS ='" & ComboBox2.SelectedItem.ToString() & "' ) and ( DAY  between " & day & " and " & day1 & ")  and ( MONTH between " & mon & " and " & mon1 & " ) and (YEAR between " & yr & " and " & yr1 & ")"
    sqlcom = New MySqlCommand(query1, sqlcon)
    da1 = New MySqlDataAdapter(sqlcom)
    da1.Fill(ds1)
    noofclass = ds1.Tables(0).Rows.Count()
    query = "select * from attendence_master where ( REGISTER_NO='" & TextBox1.Text & "')  and ( SUBJECT='" & ComboBox1.SelectedItem.text & "' )  and ( LECTURER_NAME='" & TextBox4.Text & "' ) and ( ATTENDENCE='P' ) and ( CLASS ='" & ComboBox2.SelectedItem.ToString() & "' ) and  ( DAY  between " & day & " and " & day1 & ")  and ( MONTH between " & mon & " and " & mon1 & " ) and (YEAR between " & yr & " and " & yr1 & ")"
    sqlcom = New MySqlCommand(query, sqlcon)
    da = New MySqlDataAdapter(sqlcom)
    da.Fill(ds)
    attendedclass = ds.Tables(0).Rows.Count()
    DataGridView1.DataSource = ds
    sqlcon.Close()
i cannot store date in mysql data base , cz i cld nt convert the format of datetimepicker n vb , . now i hve split the values of dtpicker and stored it as integer n data base ,.. need help to execute the query .. help plz .. ty
 
    