Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
retrieve data from table when we select a date,
Posted
Comments
Schatak 11-Apr-14 3:24am    
please elaborate bit more. what you want to say in one line? how you want to select date, from where you are selecting a date, do you want to pass a date into query?

on Button Click

"Select * from table where date = '" + txtdate.text + "'";
 
Share this answer
 
drag a new datetimepicker control to form!!! allow you to pick a datetime

Example:

VB
dim connection as new sqlconnection=""
dim selectme as string="SELECT * FROM table WHERE myDate ='"& datetimepicker1.text &"'" 
dim cmdme as new sqlcommand(selectme,connection)
Dim sqladpt As New OleDbDataAdapter
        Dim tbl As New DataTable
        With cmdme
            .CommandText = selectme
            .Connection = connection
        End With
        With sqladpt
            .SelectCommand = cmdme
            .Fill(tbl)
        End With
        DataGridView1.Rows.Clear()
        For i = 0 To tbl.Rows.Count - 1
            With DataGridView1
                .Rows.Add(tbl.Rows(i)("fieldname"), tbl.Rows(i)("fieldname"))
            End With
        Next
        connection.Close()


just change the datetimepicker1.value or text to match your table's current datatype
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900