Single record data binding ASP to SQLSvr2000

  • I have a problem connecting to SQL Server 2000 from an ASP page.

    The following code works fine:

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

    set rsProjList = Server.CreateObject("ADODB.Recordset")

    sqlProjList = "select * from PROJECT"

    conProjList.Open "dsn=dsnname","user","userpass"

    However, I'm trying to create a disconnected record set, and I've tried a couple of code snippets from books and tutorials which give the following code for handling single record binding:

    <object CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID="objDC" HEIGHT="0" WIDTH="0">

    <param name="Connect" value="DSN=dsname">

    <param name="Server" value="myserver">

    <param name="SQL" value="select * from PROJECT">

    </object>

    When I use the code in the second example, no data is being retrieved, and any attempted data operations report that the object is closed (and I still dont understand why it should allow a connection without supplying a username and password, like in the first example)

    I'm not sure which "Server" I should be referencing - is this the IIS root web server, the virtual server for my ASP project, the SQL Server name, or the name of the box on which they all reside? I thought I was keeping it simple by having the web server and SQL server on the same machine.

    If the problem isn't with the "server" parameter - any ideas where I should look next?

    Thanks - all comments gratefully received!

    Paul Hopkins

  • Hey Paul,

    ASP a bit out of my element, but here is what I know...or think I know. Most ASP work is done using Server.whatever, meaning it happens on the IIS box and gets streamed to the client from there. That includes most recordsets. It's possible to write code to open a connection from the client directly to the SQL box, which should allow data binding. Beyond that there is RDS - which I have not used, and of course XML which you could use in concert with the new XML abilities in the SQL2K web release.

    Hopefully others have more answers!

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

Viewing 2 posts - 1 through 1 (of 1 total)

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