Results 1 to 2 of 2

Thread: ASP.net > Open Close db Connection: Best Practice

  1. #1

    ASP.net > Open Close db Connection: Best Practice

    Hi,

    I am a Classic ASP developer and now learning ASP.net.
    In Classic ASP, I developed a few functions that Connects, Executes Queries & Disconnect databases like for example:

    PHP Code:
    //To Connection to db
      
    set objConn connectDB() 
    PHP Code:
    //Exceute Select Query
      
    set rRecordSet executeQuery("sql query here"objConn
    PHP Code:
    //Disconnect database
      
    disConnect(objConn
    Is there any Expert .Net developer who can guide me on how to create similar functions in .Net so that I do not have to write same db connection code in each page of application.


    Thanks!

  2. #2
    Join Date
    Dec 2009
    Posts
    1,232
    Why not write this as an external file like db.aspx and then include it on the page?

Similar Threads

  1. Replies: 0
    Last Post: 06 Oct 2009, 11:09 AM
  2. Free ASP.NET Application with code to practice
    By dexterz in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 23 Dec 2005, 03:12 AM

Posting Permissions

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