Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003

    Unhappy Unanswered: accessing sql7 database using ADO and ASP web page.

    Hello all!

    I am kinda new to using sql 7.0 and am trying to set up a web page that will access a sql7 database. I have a database with several tables in it created on my machine. My asp page uses a connection string that looks like:

    "strConnect = "Provider=SQLOLEDB; PersistantSecurity Info= False; User ID = sa; password = 1234; Initial Catalog=equip;Initial file Name =c:\mssql7\data\tracking_data.mdf""

    When I try to load this page my web browser displays the "page cannot be displayed error" and shows an error type of

    "Microsoft OLE DB Provider for SQL Server (0x80004005)
    Device activation error. The physical file name 'c:\mssql7\data\tracking_data.mdf' may be incorrect.
    /tracking/rptsvrc.asp, line 22"

    Line 22 of the page rptsvrc.asp contains the code:
    "objCommand.ActiveConnection = strConnect"
    I am at a lose as to why this doesn't work. The file name and path are correct and they do exist.

    ANy suggestions here?

    Thanks CVC505

  2. #2
    Join Date
    Oct 2003
    Your connection string should be something like this:

    "provider=SQLOLEDB;server=SQLServerName;uid=userid ;password=password;database=DatabaseName;Trusted_C onnection=No"

    DatabaseName points to the logical db name not the filename.

    Hope this helps...

  3. #3
    Join Date
    Oct 2003

    accessing sql7 database using ADO and ASP web page.

    Thanks for the suggestion but it still does not work. I have changed my programs to that list 23 reads:

    objConn.Open "Provider=SQLOLEDB; Server=rick2; User ID = sa; Database = equip; Trusted_connection = no"

    Where rick2 is the server name ( I changed servers for the weekend)
    equip is the database name as it appears in the EM list.

    and line 24 is now:
    objRS.Open "user1", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

    where user1 is the table name in the equip database.

    When I try to make the connection now I get an error that says:

    Error Type:
    Microsoft OLE DB Provider for SQL Server (0x80040E37)
    Invalid object name 'user1'.
    /tracking/rptsvrc.asp, line 24

    This has me stumped because it will work about once then quit.
    One other thing I have noticed; when I created this database in the EM, I had named it Tracking ( In the data subdirectory the file is named tracking_data.mdf). The first time I ran the program the name in the EM changed to equip. ( still is named Tracking_data.mdf in the dat subdirectory). I am so new to this I don't have a clue what to look for.

  4. #4
    Join Date
    Oct 2003
    Your connection seems to be working now but it is not finding the table user1.

    Try changing you recordset open to a simple query:

    'SELECT * FROM syscolumns'

    See if that returns anything.

    You can also try prefixing user1 with its owner. I.E. dbo.user1

Posting Permissions

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