From: | frank_lupo <frank_lupo(at)email(dot)it> |
---|---|
To: | dpage <dpage(at)vale-housing(dot)co(dot)uk> |
Cc: | dpage <dpage(at)vale-housing(dot)co(dot)uk> |
Subject: | Re: Add a definable row limit to 'View Data' |
Date: | 2003-02-28 11:10:15 |
Message-ID: | HB0N13$0F06FD1AA8202E66A6B3CC03E7EB894F@email.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-hackers |
>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.
Sub corrected using your suggestions:
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 iMsgBoxResult As VbMsgBoxResult
Dim szLimit As String
Dim szTemp As String
Const ROW_LIMIT As Integer = 5000
'count row
StartMsg "Counting Records..."
Set rsQuery = frmMain.svr.Databases(ctx.CurrentDB).Execute("SELECT count(*) AS count FROM "
& ctx.C
u
rrentObject.FormattedID)
EndMsg
'verify limit output
szLimit = ""
If Not rsQuery.EOF Then
If rsQuery!Count > ROW_LIMIT Then
iMsgBoxResult = MsgBox("The query returned more than " & rsQuery!Count & " rows. Do you wish to LIMIT the output?", vbApplicationModal + vbYesNoCancel + vbQuestion, "Row limit")
If iMsgBoxResult = vbCancel Then
Exit Sub
ElseIf iMsgBoxResult = vbYes Then
szTemp = InputBox("Insert row limit" & vbCrLf & "Table contain " & rsQuery!Count & " rows", "Row limit", ROW_LIMIT)
If Not IsNumeric(szTemp) Then Exit Sub
szLimit = " LIMIT " & szTemp
End If
End If
End If
StartMsg "Executing SQL Query..."
Set rsQuery = frmMain.svr.Databases(ctx.CurrentDB).Execute("SELECT * FROM " & ctx.CurrentObject.FormattedID & szLimit)
Load objOutputForm
objOutputForm.Display rsQuery,
ctx.Cur
r
entDB, "(" & 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:
Natsabe.it la più grande erboristeria online italiana
con consegna gratuita a partire da soli 50 euro !
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=1307&d=28-2
From | Date | Subject | |
---|---|---|---|
Next Message | frank_lupo | 2003-02-28 13:08:36 | create class application to add in schema |
Previous Message | frank_lupo | 2003-02-28 10:53:11 | Re: problem to developing the lock |