Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2003
    Posts
    32

    Unanswered: access SQL SERVER 2000 DB from an asp page

    Hi,

    I'm using sql server 2000 database and trying to access it using asp.
    when i installed sql server, i selected the mixed mode of authentication(windows and sql server).

    but it gives me the following error.....
    ------------------------------------
    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sa'.
    /rocky/basichits.asp, line 160
    ------------------------------------

    i gave the uid and pwd as "sa" and "srivalli" respectively for the sql server itself.

    my basichits.asp code looks like this....
    ---------------------------------
    set c=server.CreateObject("adodb.connection")
    c.Open "Driver={SQL Server};server=localhost;database=rmmlf;UID=sa;PAS S=srivalli"
    ---------------------------------

    Could anyone please help me out with it?

    thanks, in advance!!!!!!!!!

  2. #2
    Join Date
    Jan 2003
    Location
    New York
    Posts
    160
    double check your ODBC Connection
    Beyond Limitation

  3. #3
    Join Date
    Oct 2003
    Posts
    32

    still a problem/........

    thanks vextout....

    my odbc is good, i guess.....i dont see any problem with it.!!!!!
    moreover, i'm dynamically loading the driver as shown below...

    ---------------------------------
    set c=server.CreateObject("adodb.connection")
    c.Open "Driver={SQL Server};server=localhost;database=rmmlf;UID=sa;PAS
    S=srivalli"
    ---------------------------------

    could u tell me how to proceed?

    thanks.

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    I've never used "UID" and "PASS", but unstead "User ID" and "Password"

    Example:
    Code:
    strConn="Provider=SQLOLEDB; Data Source=<servername>; Initial Catalog=<database name>; User Id=<sql user id>; Password=<sql user password>"
    Might be worth a try...

    As a side note, don't use "sa" for your web applications. Create a user and give it rights to only what is necessary. Otherwise you leave your entire system open and prone to hacks.
    Last edited by Seppuku; 10-24-03 at 19:45.
    That which does not kill me postpones the inevitable.

  5. #5
    Join Date
    Oct 2003
    Posts
    32

    thanks

    hi vextout,
    i would definitely try it out in my office on monday....
    thanks a lot for the info.

  6. #6
    Join Date
    Oct 2003
    Location
    India
    Posts
    55

    Wink Asp Connection With Sql

    Instead of connecting using a connection String use a DSN.

    Create a DSN for your connection on the iis server machine,Test it then
    use

    Con.ConnectionString="DSN=DSNNAME"
    Con.open


    This should work

    Try it out
    Sree

  7. #7
    Join Date
    Oct 2003
    Posts
    32

    thanks all

    thanks all very much!
    my thing is working with a DSN name!!!!!
    thanks again

  8. #8
    Join Date
    Oct 2003
    Posts
    32

    why only DSN?????

    still wondering why always have a dsta source set up?
    cant i load the driver dynamically and still get it working???

    any ideas......

    thanks a lot in advance.

  9. #9
    Join Date
    Oct 2003
    Location
    India
    Posts
    55

    Cool DSN

    IT is not that it will work only with DSN.

    Try building the Connection String using a ADODC data control and copy and paste the connectionstring .
    So the matter is you have to have the correct connection string.

    Thats all.

    Regards
    Sree

  10. #10
    Join Date
    Oct 2003
    Posts
    32

    Thanks sree

    Hi sree...thanks...

    but i still do not find anything wrong in my connection string.....
    set c=server.CreateObject("adodb.connection")
    c.Open "Driver={SQL Server};server=localhost;database=rmmlf;UID=sa;PAS
    S=srivalli"

    my sql server is in the machine where my iis server is running....so i put localhost.and my database name is rmmlf....when installing sql server, i used mixed authentication mode....and hence those id and password!!!

    any idea where i'm mistaken?

    thanks....

  11. #11
    Join Date
    Oct 2003
    Location
    India
    Posts
    55

    ASP ADO

    Hi

    As i said earlier just create a connection to your database using ADODC Data Control and compare it with your connection String.

    Reards
    Sree

Posting Permissions

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