Hi Frank,

I'm not sure this is the best way to do this. How about a preset option in frmOptions 
for the number of rows. Then when the query is run, we say:

The query returned more than XXX rows. Do you wish to LIMIT the output?

Yes/No/Cancel

Yes = Limit
No = Return all rows
Cancel = Abort

What do you think?

Regards, Dave.



> -----Original Message-----
> From: frank_lupo [mailto:[EMAIL PROTECTED] 
> Sent: 24 February 2003 13:30
> To: pgadmin-hackers
> Subject: [pgadmin-hackers] Add a definable row limit to 'View Data'
> 
> 
> The sub is in frmmain.
> 
> 
> 
> 
> 
> Private Sub mnuPopupViewData_Click()
> 
> On Error GoTo Err_Handler
> 
> svr.LogEvent "Entering " & App.Title & 
> ":frmMain.mnuPopupViewData_Click()", etFullDebug
> 
>   
> 
> Dim objOutputForm As New frmSQLOutput
> 
> Dim rsQuery As New Recordset
> 
> Dim szTemp As String
> 
> Dim lLimit As Long
> 
> Dim lNumRow As Long
> 
> Const ROW_LIMIT_QUESTION As Long = 5000
> 
> 
> 
>   'count row
> 
>   lNumRow = 0
> 
>   StartMsg "Counting Records..."
> 
>   Set rsQuery = 
> frmMain.svr.Databases(ctx.CurrentDB).Execute("SELECT count(*) 
> AS count FROM " & ctx.CurrentObject.FormattedID)
> 
>   If Not rsQuery.EOF Then lNumRow = rsQuery!Count
> 
>   EndMsg
> 
> 
> 
>   'Add a definable row limit to 'View Data'
> 
>   szTemp = InputBox("Insert row limit" & vbCrLf & "Table 
> contain " & lNumRow & " rows", "Row limit", lNumRow)
> 
>   If Len(szTemp) = 0 Then Exit Sub
> 
>   lLimit = 0
> 
>   If IsNumeric(szTemp) Then lLimit = szTemp
> 
>   szTemp = "LIMIT " & lLimit
> 
>   
> 
>   If lLimit > ROW_LIMIT_QUESTION And lNumRow > 0 Then
> 
>     If MsgBox("The row limit is " & lLimit & ". The records 
> which may take some time to load." & vbCrLf & "Do you wish to 
> continue?", vbQuestion + vbYesNo, "Continue?") = vbNo Then Exit Sub
> 
>   End If
> 
>   
> 
>   StartMsg "Executing SQL Query..."
> 
>   Set rsQuery = 
> frmMain.svr.Databases(ctx.CurrentDB).Execute("SELECT * FROM " 
> & ctx.CurrentObject.FormattedID & szTemp)
> 
>   Load objOutputForm
> 
>   objOutputForm.Display rsQuery, ctx.CurrentDB, "(" & 
> ctx.CurrentObject.ObjectType & ": " & 
> ctx.CurrentObject.FormattedID & ")"
> 
>   objOutputForm.Show
> 
>   EndMsg
> 
>   
> 
>   Exit Sub
> 
>   
> 
> Err_Handler:
> 
>   EndMsg
> 
>   If Err.Number <> 0 Then LogError Err.Number, 
> Err.Description, App.Title & ":frmMain.mnuPopupViewData_Click"
> 
> End Sub
> 
> 
> 
> 
> 
> 
> 
> Bye !!
> 
> Frank Lupo (Wolf) !!
> 
> 
> 
>     /\_ _/\
> 
>     \ o o /
> 
> --ooo-----ooo---
> 
> 
> 
> --
> Prendi GRATIS l'email universale che... risparmia: 
http://www.email.it/f

Sponsor:
Il lavandino che gocciola ti fa innervosire? L'idraulico che ti serve lo trovi su 
QxService! Clicca qui ed il tuo problema sarà risolto!! Clicca qui: 
http://adv.email.it/cgi-bin/foclick.cgi?mid=840&d=24-2

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to