DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: How to filter Data in a datagrid according to date (VB.Net windows application)

  1. #1
    Join Date
    Nov 2006
    Location
    India, Kerala
    Posts
    19

    How to filter Data in a datagrid according to date (VB.Net windows application)

    In my application i want to filter Data in a datagrid according to date.
    my database have one datetime field .and i want to filter data from one date to other.

    This is my code. but have some error in query.
    pls help. i'm confused with its syntax.




    ssql = " SELECT * FROM Agreements WHERE ReturnedToOn BETWEEN '" DateTimePicker1.value.ToString()'" AND '"DateTimePicker2.value.ToString()'""

    sqlda = New OleDbDataAdapter(ssql, sqlcon)

    sqlds = New DataSet
    sqlds.Clear()

    sqlda.Fill(sqlds, "ssql")
    DataGrid1.DataSource = sqlds.Tables(0)

    sqlcon.Close()

  2. #2
    Join Date
    Nov 2006
    Location
    India, Kerala
    Posts
    19
    got Syntax its now Working. Thank u for Phill Weber. he indirectly helped me.

    ssql = " SELECT * FROM Agreements WHERE ReturnedToOn BETWEEN #" + Convert.ToDateTime(DateTimePicker1.Value.ToString()) + "# AND #" + Convert.ToDateTime(DateTimePicker2.Value.ToString()) + "# "

  3. #3
    Join Date
    Jul 2007
    Location
    Durban in Newlands West
    Posts
    6

    Unhappy Datagrid Problems too!

    My dataset doesnt seem to filling wen I run my program. It gives me a "Data set not filled" problem. I'm using Oracle2, can you please please help. I don't know wat to do anymore i'm fustrated!!

Similar Threads

  1. Replies: 1
    Last Post: 11-15-2006, 06:13 AM
  2. vb.net Filter in Datagrid
    By daveryan78 in forum .NET
    Replies: 0
    Last Post: 08-04-2006, 06:29 AM
  3. Replies: 4
    Last Post: 05-19-2006, 03:58 PM
  4. Replies: 1
    Last Post: 05-02-2005, 02:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center