Click here to Skip to main content
15,886,199 members
Home / Discussions / Database
   

Database

 
QuestionGet databases Pin
Syed Mujtaba Hassan2-Sep-07 20:15
Syed Mujtaba Hassan2-Sep-07 20:15 
AnswerRe: Get databases Pin
John-ph2-Sep-07 20:43
John-ph2-Sep-07 20:43 
AnswerRe: Get databases Pin
shivvish2-Sep-07 21:12
shivvish2-Sep-07 21:12 
GeneralRe: Get databases Pin
Syed Mujtaba Hassan2-Sep-07 22:42
Syed Mujtaba Hassan2-Sep-07 22:42 
Questionlogin problem in sql server express Pin
prasadbuddhika2-Sep-07 17:50
prasadbuddhika2-Sep-07 17:50 
AnswerRe: login problem in sql server express Pin
M LN Rao2-Sep-07 21:32
M LN Rao2-Sep-07 21:32 
AnswerRe: login problem in sql server express Pin
John Gathogo3-Sep-07 20:28
John Gathogo3-Sep-07 20:28 
QuestionSQL Order By in paging algorithim Pin
Polymorpher2-Sep-07 11:50
Polymorpher2-Sep-07 11:50 
ok, here is the code:

Private Sub CreateProcedure(ByVal con As SqlClient.SqlConnection)
Dim curRowIndex As Integer = ((GetCurPageIndex() * RowsPerPage) + 1)
If curRowIndex > GetTotalRowCount() Then
mCurPageIndex = NumPagesAvailable()
curRowIndex = GetTotalRowCount()
End If

Dim createProcedureSQL As String = "CREATE PROCEDURE [dbo].[PageResultsProcedure]"
createProcedureSQL &= "AS" & vbCr
createProcedureSQL &= "DECLARE @FirstID INT, @StartRow INT" & vbCr
createProcedureSQL &= "SET ROWCOUNT " & curRowIndex & vbCr
createProcedureSQL &= "SELECT @FirstID = " & TablePKName & " FROM " & TableName & " " & WhereSegment & vbCr
createProcedureSQL &= "SET ROWCOUNT " & RowsPerPage & vbCr
createProcedureSQL &= "SELECT " & ColumnsToReturn & " FROM " & TableName & CStr(IIf(WhereSegment = "", " WHERE ", " " & WhereSegment & " AND ")) & TablePKName & " >= @FirstID" & vbCr
createProcedureSQL &= "ORDER BY " & TablePKName & vbCr
createProcedureSQL &= "SET ROWCOUNT 0"

Dim cmd As SqlClient.SqlCommand

cmd = con.CreateCommand
cmd.CommandText = createProcedureSQL
con.Open()
cmd.ExecuteNonQuery()
con.Close()
cmd.Dispose()
cmd = Nothing
End Sub

This code is part of a procedure to allow paging a data table...the question is; I need a way of doing this, but being able to sort the results by a given column that is not guaranteed to have unique values in the table...Any Ideas? Thanks in advance for any help.

--
"Keyboard not found. Press < F1 > to RESUME. "
Source unknown (appears in many common BIOSes as a real error message)

AnswerRe: SQL Order By in paging algorithim Pin
Colin Angus Mackay2-Sep-07 12:04
Colin Angus Mackay2-Sep-07 12:04 
GeneralRe: SQL Order By in paging algorithim Pin
Polymorpher2-Sep-07 15:50
Polymorpher2-Sep-07 15:50 
GeneralRe: SQL Order By in paging algorithim Pin
Colin Angus Mackay2-Sep-07 22:54
Colin Angus Mackay2-Sep-07 22:54 
AnswerRe: SQL Order By in paging algorithim Pin
Colin Angus Mackay2-Sep-07 14:06
Colin Angus Mackay2-Sep-07 14:06 
GeneralRe: SQL Order By in paging algorithim Pin
Polymorpher2-Sep-07 15:51
Polymorpher2-Sep-07 15:51 
GeneralRe: SQL Order By in paging algorithim Pin
Colin Angus Mackay2-Sep-07 22:56
Colin Angus Mackay2-Sep-07 22:56 
Questioncount query Pin
Deian2-Sep-07 7:12
Deian2-Sep-07 7:12 
AnswerRe: count query Pin
Arjan Einbu2-Sep-07 11:18
Arjan Einbu2-Sep-07 11:18 
GeneralRe: count query Pin
Deian2-Sep-07 20:57
Deian2-Sep-07 20:57 
GeneralRe: count query Pin
Arjan Einbu2-Sep-07 21:29
Arjan Einbu2-Sep-07 21:29 
Questionwhat is the difference between roles Pin
prasadbuddhika1-Sep-07 16:45
prasadbuddhika1-Sep-07 16:45 
AnswerRe: what is the difference between roles Pin
Vasudevan Deepak Kumar2-Sep-07 0:51
Vasudevan Deepak Kumar2-Sep-07 0:51 
QuestionSQL 2005 Execute permissions Pin
mtone1-Sep-07 5:57
mtone1-Sep-07 5:57 
Questionerror!! Pin
Rharzkie1-Sep-07 1:44
Rharzkie1-Sep-07 1:44 
AnswerRe: error!! Pin
Vasudevan Deepak Kumar2-Sep-07 0:50
Vasudevan Deepak Kumar2-Sep-07 0:50 
AnswerRe: error!! Pin
Paul Conrad2-Sep-07 5:32
professionalPaul Conrad2-Sep-07 5:32 
Questioni can't connect in the connection wizard! Pin
Rharzkie1-Sep-07 0:45
Rharzkie1-Sep-07 0:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.