General questions about SQL db connection using ASP pages.

Discussion in 'ASP General' started by Brave, Apr 21, 2006.

  1. Brave

    Brave Guest

    Hi,

    I normally work with MS Access databases using ASP pages. I have been
    given the opprotunity to work on some available SQL server space, and
    wanted to ask a couple of questions. The following is a simple update
    query that I use. It is an ASP page that connects to an MS Access Db:

    <%
    Set Conn = Server.CreateObject("ADODB.Connection")
    myDSN = "DRIVER={Microsoft Access Driver (*.mdb)};"
    myDSN = myDSN & "DBQ=\\xxxxx\xxxxx\xxxxx\database003.mdb"
    mySQL="UPDATE SKUList SET SKUList.Department='Furniture' WHERE
    SKU='123456'"
    Conn.Open(myDSN)
    Conn.Execute(mySQL)
    Conn.Close
    Set Conn = Nothing
    %>

    I was wondering if someone could tell me (or better yet show me) how
    this code would look in a SQL server enviroment. I have no information
    on the server itself as the database will be setup for me, and I will
    just need to create ASP pages to connect.

    Any information, SQL code samples, or even a good online resource to
    help me get started.
    I think once I see a a couple of codes examples, then it will fall into
    place for me.

    Thanks for your time.
     
    Brave, Apr 21, 2006
    #1
    1. Advertising

  2. Brave wrote:
    > Hi,
    >
    > I normally work with MS Access databases using ASP pages. I have been
    > given the opprotunity to work on some available SQL server space, and
    > wanted to ask a couple of questions. The following is a simple update
    > query that I use. It is an ASP page that connects to an MS Access Db:
    >
    > <%
    > Set Conn = Server.CreateObject("ADODB.Connection")
    > myDSN = "DRIVER={Microsoft Access Driver (*.mdb)};"
    > myDSN = myDSN & "DBQ=\\xxxxx\xxxxx\xxxxx\database003.mdb"


    I prefer to use the native OLE DB provider:
    myDSN="Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=\\xxxxx\xxxxx\xxxxx\database003.mdb"

    > mySQL="UPDATE SKUList SET SKUList.Department='Furniture' WHERE
    > SKU='123456'"
    > Conn.Open(myDSN)
    > Conn.Execute(mySQL)
    > Conn.Close
    > Set Conn = Nothing
    > %>
    >
    > I was wondering if someone could tell me (or better yet show me) how
    > this code would look in a SQL server enviroment. I have no information
    > on the server itself as the database will be setup for me, and I will
    > just need to create ASP pages to connect.


    Very similar. The connection string will change, and how it looks will
    depend on whether your server is set up with Windows or Mixed authority.
    See:
    http://www.aspfaq.com/show.asp?id=2126

    I will say that if you plan to continue building sql statements in vbscript
    and passing them to the database, instead of using parameterized stored
    procedures (whih is also possible in Access). you will miss out on many of
    the optimizations that make moving to SQL Server desirable. See:

    http://tinyurl.com/jyy0,
    as well as:
    http://groups.google.com/groups?hl=...=1&selm=
    http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e
    http://mvp.unixwiz.net/techtips/sql-injection.html
    http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23
    >
    > Any information, SQL code samples, or even a good online resource to
    > help me get started.
    > I think once I see a a couple of codes examples, then it will fall
    > into place for me.
    >

    www.aspfaq.com
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Apr 21, 2006
    #2
    1. Advertising

  3. Brave

    Brave Guest

    Thank you for taking the time to reply. I will look at the website you
    have suggested.
     
    Brave, Apr 21, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Johnny  Meredith
    Replies:
    1
    Views:
    476
    Brock Allen
    Jun 12, 2005
  2. HalcyonWild
    Replies:
    2
    Views:
    939
    HalcyonWild
    Dec 19, 2005
  3. asdsd sir
    Replies:
    1
    Views:
    341
    Diez B. Roggisch
    Feb 16, 2006
  4. ak
    Replies:
    8
    Views:
    715
  5. Robert Everland III

    Question on how ASP communicates and general questions

    Robert Everland III, Dec 8, 2003, in forum: ASP General
    Replies:
    11
    Views:
    882
    Tim Slattery
    Dec 8, 2003
Loading...

Share This Page