borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (create a setup file in vb.net)Next Topic (Fetch Individual Values from Datagrid) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : see data in datagrid as per date and data will be sorted in ascending order Solved Topic
Poster Message
tanmoy
Level: Whizz Kid

Registered: 17-03-2006
Posts: 18

icon see data in datagrid as per date and data will be sorted in ascending order

hello sir.i want to see some data from database in a datagrid as per date sequencially.the data is coming in datagrid as per date but data is not sequncially desangied.actualy in my table there was a field.name"trID".and this field the data is in 1,2,3,4,5,6,7 in this format.now i want to see some data in datagrid as per date.i use this coding.
Dim seldat As New OleDb.OleDbDataAdapter()
            pm.TextBox2.Text = pm.DateTimePicker1.Value
            Dim inv As String
            inv = "select * from payment where Dat=# " & pm.TextBox2.Text & " # "
            seldat.SelectCommand = New OleDb.OleDbCommand(inv, con)
            ds.Tables("payment").Clear()
            seldat.Fill(ds, "payment")
            pm.DataGrid1.DataSource = ds.Tables("payment")
but with this coding the data is sort as per date so the data is not showing sequencialy.i mean after the data short as per date i want to do a another sort of this data as per "trID" in ascending order.i mean i want to show data as per date. and the date will be given by user.and the data will be sorted by field name"trID" in ascending order.please help me.thank you.

____________________________
ambarish sadhu

17-04-2006 at 07:40 PM
View Profile Send Email to User Show All Posts | Quote Reply
xtramac
Level: Professor


Registered: 28-08-2005
Posts: 89
icon Re: see data in datagrid as per date and data will be sorted in ascending order

hello,

in order to get a resultset that is arrange in some logical order, you have to include the keyword 'Order By'.. like for example

Select * from payment where dat = # .... # order by trID

note:
by default its ordered ascending to change it do descending just add DESC after trID.

hope this helps...

    

andrew

18-04-2006 at 01:16 AM
View Profile Send Email to User Show All Posts | Quote Reply
tanmoy
Level: Whizz Kid

Registered: 17-03-2006
Posts: 18
icon Re: see data in datagrid as per date and data will be sorted in ascending order

thank you sir.the provlem is solved.

____________________________
ambarish sadhu

18-04-2006 at 06:09 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : see data in datagrid as per date and data will be sorted in ascending order Solved Topic
Previous Topic (create a setup file in vb.net)Next Topic (Fetch Individual Values from Datagrid) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder