Results 1 to 8 of 8

Thread: comman Connection

  1. #1

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724

    comman Connection

    hi

    i am a vb programmer .. petty new to asp.net
    as we have a public connection object in module can we have a connection.

    i have some events which connection to database and retrive the database....

    can i have a .. if so how and where do i need to declare it


    regards

  2. #2

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724
    make

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    huh? Your question makes no sense!
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724
    Originally posted by Cander
    huh? Your question makes no sense!

    my mistake... when u are new u dont know ur problem to right...

    ok...

    as we have connection object in module in vb6 can we have connection object in asp.net module.

    will it be the same as vb

    i tried it the connect is shared... but i can have only one datareader is it so or do we have a way of doing....


    i need to share connection datareader object across pages as we do in vb

    hope this time i make some sense

  5. #5
    Lively Member
    Join Date
    Jan 2001
    Location
    Worcester, MA
    Posts
    77
    You can add it in your web.config file in an appsettings block

    Code:
    <appsettings>
    <add key="constring" value="data source=localhost;initial catalog=northwind;UID=sa;Pwd=;"/>
    </appSettings>

    Then access it like so:

    Code:
    Imports System.Collections.Specialized
    
    
    Dim appsetting As NameValueCollection = CType(HttpContext.Current.GetConfig("appSettings"), NameValueCollection)
            conn = CStr(appsetting("constring"))
    "Find all you need in your mind if you take the time" -DT

  6. #6

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724
    Originally posted by Cin0s3
    You can add it in your web.config file in an appsettings block

    Code:
    <appsettings>
    <add key="constring" value="data source=localhost;initial catalog=northwind;UID=sa;Pwd=;"/>
    </appSettings>

    Then access it like so:

    Code:
    Imports System.Collections.Specialized
    
    
    Dim appsetting As NameValueCollection = CType(HttpContext.Current.GetConfig("appSettings"), NameValueCollection)
            conn = CStr(appsetting("constring"))

    dont u think this will share the connect string rather than the connection object.

    if u see my Q.. it is diff i am trying to open more than one datareader with same connection object

    any way thanks a lot for tip

  7. #7
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    This connection object of yours, is it like a vb module, or a compiled business object, like a dll file??? More info please.
    Whenever I need database support to my asp.net pages I use my db.dll file in which I have all the logic behind connections. Reuse code is the way to do it

    kind regards
    Henrik

  8. #8

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724
    i have connection object in module as we have in vb.

    my point is not behind connecting .. can we have more than one datareader object for same connection.

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