ADO readonly connection


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: ADO readonly connection

  1. #1
    BettyB Guest

    ADO readonly connection

    Is there any way in an ASP page to open an ADO connection that is readonly?
    There are times when the connection that normally allows updates needs to
    disallow updates. Modifying the connection means only one place that code
    needs to be changed for the entire web site.

    I have already tried the following code but it did not prevent writing to
    the database.

    var gConn = Server.CreateObject("ADODB.Connection");
    gConn.Mode = 1; // read-only permissions
    gConn.Open("DSN=tvread;UID=;PWD=");
    return gConn;


    Thanks, Betty Buhr





  2. #2
    Tim Guest

    Re: ADO readonly connection


    You can manage the database permissions at the database. If you are building
    a company intranet, you can pass the user context from a login page and submit
    the context through OLEDB(DSN-less) connection rather that with ODBC.
    sub login
    'I'm assuming SQL Server. Adjust as appropriate....
    set con=server.createobject("ADODB.Connection")
    con.Provider ="SQLOLEDB" ' or microsoft access provider or whatever.
    con.connectionString="Data source=Server;User ID=" & request.form("UserID")
    & ";Password=" * request.form("password") & ";Initial catalog=pubs"
    con.Open
    end sub

  3. #3
    BettyB Guest

    Re: ADO readonly connection

    I'm sorry, I don't understand. In what way will this code make the database
    connection readonly?

    BB

    Tim wrote in message <391a2c42$1@news.devx.com>...
    >
    >You can manage the database permissions at the database. If you are

    building
    >a company intranet, you can pass the user context from a login page and

    submit
    >the context through OLEDB(DSN-less) connection rather that with ODBC.
    >sub login
    > 'I'm assuming SQL Server. Adjust as appropriate....
    > set con=server.createobject("ADODB.Connection")
    > con.Provider ="SQLOLEDB" ' or microsoft access provider or whatever.
    > con.connectionString="Data source=Server;User ID=" &

    request.form("UserID")
    >& ";Password=" * request.form("password") & ";Initial catalog=pubs"
    > con.Open
    >end sub




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center