Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Paging Problem

Author  Topic 

ncamoens
Starting Member

9 Posts

Posted - 2006-03-14 : 12:25:53
Hello, I have a datagrid with paging allowed, but when i click on page number 2 or 3, it still displays the records from the first page. How do I solve this?

Thank you.

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-03-14 : 12:30:15
ncamoens,

Is that the all info that u r willing to provide? Its almost same as asking the Question
"How do I solve this" only.

Can u please provide some more info
Go to Top of Page

ncamoens
Starting Member

9 Posts

Posted - 2006-03-14 : 12:46:21
I'm sorry.

Here is my code:

sub cmd_Search(sender As Object, e As System.EventArgs)
Dim conn as SqlConnection = New SqlConnection("server=(local);database=APMS;Trusted_Connection =yes")

If lstColumn.Items(lstColumn.SelectedIndex).Text = "FlightID" Then
Dim comm as SqlDataAdapter = new SqlDataAdapter("select * from FlightLog where FlightID Like '" & txtSearch.text & "' ", conn)
Dim comm1 As SqlCommand = New SqlCommand("select * from FlightLog where FlightID Like '" & txtSearch.text & "' ", conn)
Dim ds as new Dataset()
Dim DrCoInfo As SqlDataReader
Dim BValid As Boolean
comm.fill(ds,"FlightLog")

comm1.connection.open()
DrCoInfo = comm1.ExecuteReader()
While DrCoInfo.Read()
If DrCoInfo("FlightID") <> "" Then
BValid = True
End If
End While

If BValid = True Then
datagrid1.datasource = ds.tables("FlightLog").defaultview
datagrid1.databind()
lblMatch.text = "Search results:"
else if bvalid = false Then
lblMatch.text = "No matches found."
end if
comm1.connection.close()

-------------

Paging has been allowed for Datagrid1 with PageSize = 5.

Hope you can help me. Thanks.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-15 : 00:47:07
It is better to post this in .NET forum

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -