Author |
Topic |
SamC
White Water Yakist
3467 Posts |
Posted - 2006-04-10 : 18:54:32
|
Stored procedures return OUTPUT parameters after the returned recordset is closed. This presents a problem if the OUTPUT contains summary information which is better presented at the top of a rendered datagrid.For example, if an OUTPUT parameter returns the total number of records in a recordset, what mechanisms work well to generate HTML like:<h3>Total records found: 948</h3><!-- 948 is returned as an OUTPUT parameter, returned last. --><table ...>-- Datagrid goes here, built from the recordset which is returned first.Is there a best way of solving this problem? |
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2006-04-10 : 19:32:34
|
Do something like this.<h3>Total Records found: <%= MyDataGrid.Items.Count %></h3><asp:DataGrid id="MyDataGrid">...</asp:DataGrid> |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2006-04-10 : 20:00:45
|
That may work in .NET. I'm working with a simple ASP datagrid that won't define Items.Count before the datagrid is rendered. |
|
|
twhelan1
Yak Posting Veteran
71 Posts |
Posted - 2006-04-11 : 10:48:13
|
It's been a long time since I've done this, but doesn't the RecordSet object have a .RecordCount or something like that, property? You may have to change the type of RecordSet you use, but I think the default options allow for that (adOpenDynamic or some such).~Travis |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-04-11 : 15:02:16
|
something like this?dim htmGrid, allHtm' build the grid herehtmGrid = htmGrid & stuffallHtm = outputVar & htmGridGo with the flow & have fun! Else fight the flow Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"] |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2006-04-11 : 16:20:39
|
quote: Originally posted by spirit1 dim htmGrid, allHtm' build the grid herehtmGrid = htmGrid & stuffallHtm = outputVar & htmGrid
That will do it, but it increases memory usage. I guess .NET does this behind the scenes. |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2006-04-11 : 17:34:03
|
Sam, you could use some dynamically rendered javascript at the bottom of your grid to pop some content into a div / span / etc client side once the page is rendered.Michael<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights. |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2006-04-11 : 17:49:46
|
quote: Originally posted by MichaelP Sam, you could use some dynamically rendered javascript at the bottom of your grid to pop some content into a div / span / etc client side once the page is rendered.
I like that idea. I'm just JavaScript literate enough to figure it out.body.innerHTML = '' // clear the page I'll need to modify the ASP datagrid class source code to pull the OUTPUT parameter (not all the SPs return the OUTPUT parameter, so I guess ON ERROR RESUME NEXT should suffice...Is there a way in ASP/ADO to interrogate a SP for the existence of OUTPUT parameters? |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2006-04-11 : 19:06:18
|
I think so Sam. Take a look at this:Set cmd = New ADODB.CommandWith cmdSet .ActiveConnection = cn.CommandText = "CustOrdersDetail".CommandType = adCmdStoredProcSet params = .ParametersEnd With About 3/4's the way down on http://www.sqlservercentral.com/columnists/awarren/introductiontoadopart4combiningitall.aspMichael<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights. |
|
|
|