Setting Up SQL Server

  • Hello All,

    I have set up SQL Server (personal edition) on my computer and am trying to access it via an Internet browser with no success. Here are the steps I've used to set up the SQL Server, please can you advise of any errors:

    1.Authentication: SQL Server and Windows

    2.Driver (set up via Datasources in Control Panel)

    System DSN, SQL Server, name = local server, type = (local), Login ID = sa, password = blanc (on testing driver = "Test Completed Successfully!")

    3. SQL Server is running on a web server called SERVER1 and I can tell it is running properly as I have the server icon with a little green arrow in the right hand corner of the screen (running on NT).

    4. My ASP for connection to Northwind Database is as follows:

    <%

    Dim Conn

    Dim Com

    Dim Rs

    set conn = Server.CreateObject("ADODB.Connection")

    set Com = Sever.CreateObject("ADODB.command")

    set Rs = Server.CreateObject("ADODB.recordset")

    conn.provider="SQLOLEDB"

    conn.connectionstring="Data Source=(local); initial catalog=pubs; user id=sa; password="

    Com.activeconnection=Conn

    conn.open

    set Com.activeconnection=Conn

    Com.commandtext="select * from customers"

    set Rs=com.execute

    do until rs.eof=true

    for each x in rs.fields

    response.write(x.name)

    response.write("=")

    response.write(x.value)

    next

    rs.movenext

    loop

    %>

    Any advice would be much appreciated.

    Cheers,

    Alan

  • Ared you getting an error?

    Also you state for Northwind but you conenction has pubs as the initial catalog.

  • ..I have changed the initial catalog to Northwind, with no success. I am not receiving any error notification.

    Any further recommendations would be appreciated.

    Cheers,

    Alan

    Edited by - asthor on 07/30/2003 08:37:57 AM

  • I have vb then just generate the connection string from ther and use this...

    Other thing remove the unneccessary steps from ur code ur purpose should be to test the connection so open a connection and then just open recordset with connection reference and then print the recordcount of the recordset and lets see if something comes up......

    Change ur code still not work then paste I will test it here...

    Cheers....

    Prakash

    Prakash Heda
    Lead DBA Team - www.sqlfeatures.com
    Video sessions on Performance Tuning and SQL 2012 HA

  • Hi Prakesh,

    I'm heading out the office now, but will try your recommendations tomorrow.

    Thanks,

    Alan

  • <%

    Dim Conn

    Dim Com

    Dim Rs

    set conn = Server.CreateObject("ADODB.Connection")

    set Com = Server.CreateObject("ADODB.command")

    set Rs = Server.CreateObject("ADODB.recordset")

    conn.provider="SQLOLEDB"

    conn.connectionstring="Data Source=(local); initial catalog=pubs; user id=sa; password="

    conn.open

    set Com.activeconnection=Conn

    Com.commandtext="select * from customers"

    set Rs=com.execute

    do until rs.eof=true

    for each x in rs.fields

    response.write(x.name)

    response.write("=")

    response.write(x.value)

    next

    rs.movenext

    loop

    %>

    'Com.activeconnection=Conn' this is not correct u should use set and I think u have to open connection before setting active connection property.

    'set Com = Sever.CreateObject("ADODB.command")' Server not Sever. I think its a typo.

    I don't see any customers table in pubs database.

    HTH

    Regards.

  • Hi Kashif,

    Cheers for pointing out the typo. I've changed the pubs database to Northwind, with no success. I intend trying to connect through VB as recommneded by Prakash, when I have some spare time.

    Where does the day go???

    Ciao,

    Alan

  • I have run the code in Kashif's answer and if you change pubs to northwind in his code, it works fine. Basically, you had 3 problems:

    1) sever

    2) pubs

    3) no set on the activeconnection

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply