Results 1 to 7 of 7

Thread: Data source name not found[resolved]

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2004
    Location
    ontario
    Posts
    24

    Resolved Data source name not found[resolved]

    This one sounds simple even to me.. sounds like a typo. But I can't find it.

    This code works when adding a new entry:

    Code:
    Set Conn = Server.CreateObject("ADODB.Connection")
           
    DSNName = "DRIVER=Microsoft Access Driver (*.mdb);DBQ="
    DSNName = DSNName & Server.MapPath("/honeyanded/database/wedding.mdb")
    Conn.Mode = 3	'3 = adModeReadWrite
    Conn.Open DSNName
    Conn.Execute(query)
    Conn.Close
    But this code gives an error (Data source name not found and no default driver specified) when I use it to open the database before reading the recordsets I need.

    Code:
    set Conn = server.CreateObject( "ADODB.Connection" )
    
    DSNName = "DRIVER=Microsoft Access Driver(*.mdb);DBQ="
    DSNName = DSNName & Server.MapPath("/honeyanded/database/wedding.mdb")
    Conn.Open DSNName
    I don't see why one works and the other doesn't.
    Last edited by CandyCanuck; Jan 27th, 2005 at 06:58 AM. Reason: resolved

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Data source name not found

    Quote Originally Posted by CandyCanuck
    But this code gives an error (Data source name not found and no default driver specified) when I use it to open the database before reading the recordsets I need.

    Code:
    set Conn = server.CreateObject( "ADODB.Connection" )
    
    DSNName = "DRIVER=Microsoft Access Driver(*.mdb);DBQ="
    DSNName = DSNName & Server.MapPath("/honeyanded/database/wedding.mdb")
    Conn.Open DSNName
    I don't see why one works and the other doesn't.
    Why are you using DSN?They are nasty, even my host discourage me too use DSN. I always use DSN less connection. If your host support DSN less connection which it should then use that instead.

    Here is an quick example just incase.

    Good luck


    Code:
    dim ConString
    dim Conn
    dim rs
    dim sql
    
    ConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/honeyanded/database/wedding.mdb")
    
    conn.Open(ConString)
    
    Set conn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.Recordset")
    
    
    sql= "Select * From GuestBook Order By PostDate"
    set rs = Conn.Execute(sql)
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2004
    Location
    ontario
    Posts
    24

    Re: Data source name not found

    I had the whole thing DSN.. now the host says it has to be DSNless and used text identical to this as the sample to follow (otherwise I would have been even more clueless, lol). So, I am converting it all.

  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Data source name not found

    Quote Originally Posted by CandyCanuck
    I had the whole thing DSN.. now the host says it has to be DSNless and used text identical to this as the sample to follow (otherwise I would have been even more clueless, lol). So, I am converting it all.
    I told you, I spoke to the owner of my host recently and he informed me that DSN connection gives them so much hadache, due to crash and performance loss, so thats why they discourage even paid customers. So I can understand why free host allow DSN connection, its a lot hassel setting it up also according to my Host it crate quite a few problem.

    Create a Include file and store your Connection String there. That way you can re-use it in all files.

    Anyhow good luck with your project. If you get stuck feel free to post again.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2004
    Location
    ontario
    Posts
    24

    Re: Data source name not found

    It is working now
    Seems to have been a missing space in the DSNName.

    I know I have done includes before, but I don't remember if I have any samples of that. I just moved and my text books are all still packed in a missing box. I'm just hoping that means it is buried at the back of the cold storage room because I am lost without them.

  6. #6
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Data source name not found

    Quote Originally Posted by CandyCanuck
    I know I have done includes before, but I don't remember if I have any samples of that. I just moved and my text books are all still packed in a missing box. I'm just hoping that means it is buried at the back of the cold storage room because I am lost without them.
    Well its your lucky day, no need for the book

    Have a look here... http://www.w3schools.com/asp/asp_incfiles.asp
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 2004
    Location
    ontario
    Posts
    24

    Re: Data source name not found

    Thanks. I bookmarked that so I can use it later.
    I have finished the guest interface tonight.. presume perfect users.
    Tomorrow I can do battle with the data validation and the administrator interface.
    Off to bed now.. take care and thanks for the help.

Posting Permissions

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



Click Here to Expand Forum to Full Width