Results 1 to 4 of 4

Thread: "Strange" things with public vars in modules...?

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    "Strange" things with public vars in modules...?

    In VB6, in a Win32 app, you can do the following in a module:
    VB Code:
    1. Option Explicit
    2.  
    3. Public gadoConn As ADODB.Connection
    Now, if 5 apps are running on the same PC, the connection object is private to each app. Fair enough. Two thumbs fresh.

    Now, when we do this in an ASP.NET app then very strange thinsg happen.

    Every user who uses the app, sees exactly the same connection object, it's not session based. This goes pear shaped as certain users have certain connection strings. BUT...sometimes the connection gets changed for user A while User B is still using it...How can I stop this?

    Bearing in mind, I am well aware public connection are not good practice.

    Woof

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: "Strange" things with public vars in modules...?

    Make it public for each user's class object.

  3. #3

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: "Strange" things with public vars in modules...?

    Bearing in mind, I am well aware public connection are not good practice.
    I think you answered your question and you know what you have to do.

Posting Permissions

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



Click Here to Expand Forum to Full Width