DSN based ODBC record set in the global.asa

Results 1 to 2 of 2

Thread: DSN based ODBC record set in the global.asa

  1. #1
    Jason Sittko Guest

    Default DSN based ODBC record set in the global.asa

    I have a small Access 2000 table (30 records & 12 fields) that is updated daily. All users access the same static-for-the-day table. While the table is small, a lot of business logic is calculated from that.<BR><BR>I can access, published and perform logic on the recordset at the session level; i.e. with a connection in the ASP page.<BR><BR>Anyway, As I learn more I am thinking I would like to get this record SET in the application state; this should help to scale as more sessions are added and each ASP would not require a separate instance of a connection since the variables should have application scope. I am not nesting applications and, in fact, the first instance of an application is quite low in the hierarchy.<BR><BR>I am having a bit of a time creating and then accessing in the ASP the application record SET. Most of the examples I see are based on manually creating (hard coding) a variable array in the global.asa then simply reading the values from the ASP; not practical.<BR><BR>...using IIS 5.0 in W2K Server RC2.<BR><BR>Anybody have any suggestions; maybe even a different method? As always, thanks in advance.<BR><BR>Jason Sittko

  2. #2
    keithadler@hotmail.com Guest

    Default RE: DSN based ODBC record set in the global.asa

    First of all, storing objects at the application scope is very treacherous from everything that I&#039ve read on the subject. But if you must, first create your recordset object ... then store it in a Application variable. E.g.<BR><BR>In your Application_OnStart:<BR><BR>Dim oRecordset<BR><BR>Set oRecordset=Server.CreateObject("ADODB.Recordset")< BR><BR>oRecordset.Open "Your SQL here","Your DSN Here",CursorType,LockType<BR><BR>Application.Lock< BR>Application("Recordset")=oRecordset<BR>Applicat ion.Unlock<BR><BR>Now anywhere in your app you can reference the recordset using Application("Recordset"). You can even saythings like ...<BR><BR>Application("Recordset").MoveFirst<BR>A pplication("Recordset").Close<BR><BR>Do Until Application("Recordset").EOF<BR><BR>Loop<BR>etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts