Working OLE DB string for an Access DB

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Working OLE DB string for an Access DB

    Hi All

    This may be striaght forward for most, but I am really getting in a tiswas
    with it.

    I have been to the able consulting, connectionstrings.com et al and I still
    can't get a working OLE DB connection string to work.

    Could somebody PLEASE post me an OLE DB connection string that allows me to
    Server.Mappath my DB and provide a password to get in it, as the DB is
    password protected. FYR, my current attempt to do this is as follows:

    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source="" & Server.Mappath("mydb.mdb") & "";" & _
    "Jet OLEDB:Database Password=fred", _
    "<I believe this is the workgroup username, but I don't
    use this>", "<I believe this is the workgroup password, but I don't use
    this>"

    This generates:

    Microsoft VBScript compilation error '800a0401'

    Expected end of statement

    /news-submit.asp, line 300

    "Data Source="" & Server.Mappath("mydb.mdb") & "";" & _
    ----------------------------------^

    If I put double quotes around the double quotes that already encapsulate my
    mdb name, to try and encode these chars I get the following:

    Microsoft OLE DB Service Components error '80040e73'

    Format of the initialization string does not conform to the OLE DB
    specification.

    /news-submit.asp, line 299

    What am I doing wrong???

    Another question is, why can't I use the ConnectionString attrib like I used
    to use for the ODBC variant? For example, I used to be able to set it up as
    follows:

    strDSN="DBQ=" & Server.Mappath("users/mydb.mdb") & ";Driver={Microsoft
    Access Driver (*.mdb)}; userID=Admin; pwd=fred"

    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.Connectionstring = strDSN
    oConn.Open

    I have a feeling this might be down to the new formatting of the OLE DB, but
    I may be wrong.

    Rgds

    Laphan




    Laphan Guest

  2. Similar Questions and Discussions

    1. Access DB Connection String Not working? PleaseHelp!!!!!
      I had a string connection to access my database directly to the server and this is the string: PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=' &amp;...
    2. DefaultValue not working (string)
      My defaultvalue attribute is not working. If i drop this control from thetoolbox onto my page the properties are empty. They keep being empty if i...
    3. "Access Denied" using public static Process Start(string, string);
      We are using Network Associates VirusScan to check files uploaded from a web page for viruses. The code below worked fine using .Net 1.1 on...
    4. aspx - string from method from in inherited class not working
      Hi all, tricky to explain this one: have got a class called Language which extends System.Web.UI.Page Language has a method "getText()" which...
    5. String matching not working
      Hi, I am quite new to Perl. I have several sets of data and within each individual file news stories are seperated using ========. My goal is...
  3. #2

    Default Re: Working OLE DB string for an Access DB

    On Mon, 9 Feb 2004 19:14:40 -0000, "Laphan" <news@DoNotEmailMe.co.uk>
    wrote:
    >Hi All
    >
    >This may be striaght forward for most, but I am really getting in a tiswas
    >with it.
    >
    >I have been to the able consulting, connectionstrings.com et al and I still
    >can't get a working OLE DB connection string to work.
    >
    >Could somebody PLEASE post me an OLE DB connection string that allows me to
    >Server.Mappath my DB and provide a password to get in it, as the DB is
    >password protected.
    This works here (one line, watch for wrap...):

    dbConnect = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
    Server.MapPath("database.mdb") & ";Jet OLEDB:Database
    Password=Password;""

    Jeff
    Jeff Cochran Guest

  4. #3

    Default Re: Working OLE DB string for an Access DB

    > Microsoft VBScript compilation error '800a0409'
    >
    > Unterminated string constant
    >
    > /news-submit.asp, line 291
    >
    > strDSN = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
    > Server.MapPath("mydb.mdb") & ";Jet OLEDB:Database Password=password;""
    > --------------------------------------------------------------------------
    --
    > --------------------------------------------------------^
    >
    > Do you know what could cause this??
    An unterminated string constant?

    Debugging 101. As he warned, watch out for the line breaks. And drop the
    extra " at the end.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand - MVP Guest

  5. #4

    Default Re: Working OLE DB string for an Access DB

    Dear Jeff

    Thanks for coming back to me, but I get:

    Microsoft VBScript compilation error '800a0409'

    Unterminated string constant

    /news-submit.asp, line 291

    strDSN = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
    Server.MapPath("mydb.mdb") & ";Jet OLEDB:Database Password=password;""
    ----------------------------------------------------------------------------
    --------------------------------------------------------^

    Do you know what could cause this??



    Jeff Cochran <jcochran.nospam@naplesgov.com> wrote in message
    news:4027e2b2.544696442@msnews.microsoft.com...
    On Mon, 9 Feb 2004 19:14:40 -0000, "Laphan" <news@DoNotEmailMe.co.uk>
    wrote:
    >Hi All
    >
    >This may be striaght forward for most, but I am really getting in a tiswas
    >with it.
    >
    >I have been to the able consulting, connectionstrings.com et al and I still
    >can't get a working OLE DB connection string to work.
    >
    >Could somebody PLEASE post me an OLE DB connection string that allows me to
    >Server.Mappath my DB and provide a password to get in it, as the DB is
    >password protected.
    This works here (one line, watch for wrap...):

    dbConnect = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
    Server.MapPath("database.mdb") & ";Jet OLEDB:Database
    Password=Password;""

    Jeff


    Laphan Guest

  6. #5

    Default Re: Working OLE DB string for an Access DB

    On Mon, 9 Feb 2004 22:57:19 -0000, "Laphan" <news@DoNotEmailMe.co.uk>
    wrote:
    >Dear Jeff
    >
    >Thanks for coming back to me, but I get:
    >
    >Microsoft VBScript compilation error '800a0409'
    >
    >Unterminated string constant
    >
    >/news-submit.asp, line 291
    >
    >strDSN = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
    >Server.MapPath("mydb.mdb") & ";Jet OLEDB:Database Password=password;""
    >----------------------------------------------------------------------------
    >--------------------------------------------------------^
    >
    >Do you know what could cause this??
    A typo in my string. :)

    The last quotation mark is not supposed to be there. I edited my
    password and inadvertently added double quotes.

    Jeff
    >Jeff Cochran <jcochran.nospam@naplesgov.com> wrote in message
    >news:4027e2b2.544696442@msnews.microsoft.com...
    >On Mon, 9 Feb 2004 19:14:40 -0000, "Laphan" <news@DoNotEmailMe.co.uk>
    >wrote:
    >
    >>Hi All
    >>
    >>This may be striaght forward for most, but I am really getting in a tiswas
    >>with it.
    >>
    >>I have been to the able consulting, connectionstrings.com et al and I still
    >>can't get a working OLE DB connection string to work.
    >>
    >>Could somebody PLEASE post me an OLE DB connection string that allows me to
    >>Server.Mappath my DB and provide a password to get in it, as the DB is
    >>password protected.
    >
    >This works here (one line, watch for wrap...):
    >
    >dbConnect = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
    >Server.MapPath("database.mdb") & ";Jet OLEDB:Database
    >Password=Password;""
    >
    >Jeff
    >
    Jeff Cochran Guest

  7. #6

    Default Re: Working OLE DB string for an Access DB

    Oh come on, show us your real password. :-)

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]

    > The last quotation mark is not supposed to be there. I edited my
    > password and inadvertently added double quotes.

    Aaron Bertrand - MVP Guest

  8. #7

    Default Re: Working OLE DB string for an Access DB

    On Tue, 10 Feb 2004 11:39:14 -0500, "Aaron Bertrand - MVP"
    <aaron@TRASHaspfaq.com> wrote:
    >Oh come on, show us your real password. :-)
    Umm... I did... Doesn't *everyone* use "password" as a password? Or
    do you make it hard by using an upper case P...? :)

    Jeff
    Jeff Cochran Guest

  9. #8

    Default Re: Working OLE DB string for an Access DB

    On Tue, 10 Feb 2004 19:29:21 GMT, [email]jcochran.nospam@naplesgov.com[/email] (Jeff Cochran) wrote:
    >On Tue, 10 Feb 2004 11:39:14 -0500, "Aaron Bertrand - MVP"
    ><aaron@TRASHaspfaq.com> wrote:
    >
    >>Oh come on, show us your real password. :-)
    >
    >Umm... I did... Doesn't *everyone* use "password" as a password? Or
    >do you make it hard by using an upper case P...? :)
    >
    >Jeff
    Actually I try to make it descriptive : pASSword

    Jvg
    Turkbear Guest

  10. #9

    Default Re: Working OLE DB string for an Access DB

    On Tue, 10 Feb 2004 14:31:45 -0600, Turkbear <noone@nowhere.com>
    wrote:
    >On Tue, 10 Feb 2004 19:29:21 GMT, [email]jcochran.nospam@naplesgov.com[/email] (Jeff Cochran) wrote:
    >
    >>On Tue, 10 Feb 2004 11:39:14 -0500, "Aaron Bertrand - MVP"
    >><aaron@TRASHaspfaq.com> wrote:
    >>
    >>>Oh come on, show us your real password. :-)
    >>
    >>Umm... I did... Doesn't *everyone* use "password" as a password? Or
    >>do you make it hard by using an upper case P...? :)
    >>
    >>Jeff
    >
    >Actually I try to make it descriptive : pASSword
    We used to have a database for employee titles with a limited length.
    Somehow the promotion to Senior Network Ass didn't impress me as much
    as the boss thought it should...

    Jeff
    (Former Title: Senior Network Associate)
    Jeff Cochran Guest

  11. #10

    Default Re: Working OLE DB string for an Access DB

    Dear Guys

    Thanks for the feedback on this.

    Can I ask that once I have made a successful connection does the Connection,
    Command and Recordset commands under OLEDB work in exactly the same way as
    the ODBC one?

    Rgds

    Laphan

    Jeff Cochran <jcochran.nospam@naplesgov.com> wrote in message
    news:402943fc.3983397@msnews.microsoft.com...
    On Tue, 10 Feb 2004 14:31:45 -0600, Turkbear <noone@nowhere.com>
    wrote:
    >On Tue, 10 Feb 2004 19:29:21 GMT, [email]jcochran.nospam@naplesgov.com[/email] (Jeff
    Cochran) wrote:
    >
    >>On Tue, 10 Feb 2004 11:39:14 -0500, "Aaron Bertrand - MVP"
    >><aaron@TRASHaspfaq.com> wrote:
    >>
    >>>Oh come on, show us your real password. :-)
    >>
    >>Umm... I did... Doesn't *everyone* use "password" as a password? Or
    >>do you make it hard by using an upper case P...? :)
    >>
    >>Jeff
    >
    >Actually I try to make it descriptive : pASSword
    We used to have a database for employee titles with a limited length.
    Somehow the promotion to Senior Network Ass didn't impress me as much
    as the boss thought it should...

    Jeff
    (Former Title: Senior Network Associate)


    Laphan Guest

  12. #11

    Default Re: Working OLE DB string for an Access DB

    I think there are a few minor differences but most of OLEDB is a superset,
    IIRC. In other words, switching to OLEDB from ODBC, you are very unlikely
    to lose any functionality. In fact, I think it is very doubtful that any
    differences will be noticeable in an ASP application.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    "Laphan" <news@DoNotEmailMe.co.uk> wrote in message
    news:uEiHdNN8DHA.2416@TK2MSFTNGP10.phx.gbl...
    > Dear Guys
    >
    > Thanks for the feedback on this.
    >
    > Can I ask that once I have made a successful connection does the
    Connection,
    > Command and Recordset commands under OLEDB work in exactly the same way as
    > the ODBC one?
    >
    > Rgds
    >
    > Laphan
    >
    > Jeff Cochran <jcochran.nospam@naplesgov.com> wrote in message
    > news:402943fc.3983397@msnews.microsoft.com...
    > On Tue, 10 Feb 2004 14:31:45 -0600, Turkbear <noone@nowhere.com>
    > wrote:
    >
    > >On Tue, 10 Feb 2004 19:29:21 GMT, [email]jcochran.nospam@naplesgov.com[/email] (Jeff
    > Cochran) wrote:
    > >
    > >>On Tue, 10 Feb 2004 11:39:14 -0500, "Aaron Bertrand - MVP"
    > >><aaron@TRASHaspfaq.com> wrote:
    > >>
    > >>>Oh come on, show us your real password. :-)
    > >>
    > >>Umm... I did... Doesn't *everyone* use "password" as a password? Or
    > >>do you make it hard by using an upper case P...? :)
    > >>
    > >>Jeff
    > >
    > >Actually I try to make it descriptive : pASSword
    >
    > We used to have a database for employee titles with a limited length.
    > Somehow the promotion to Senior Network Ass didn't impress me as much
    > as the boss thought it should...
    >
    > Jeff
    > (Former Title: Senior Network Associate)
    >
    >

    Aaron Bertrand - MVP Guest

  13. #12

    Default Re: Working OLE DB string for an Access DB

    Thanks for the prompt reply Aaron.

    I was just worried that a command such as making the connection client-side
    for paging (this is right isn't it?), would be different.

    Rgds

    Laphan

    Aaron Bertrand - MVP <aaron@TRASHaspfaq.com> wrote in message
    news:uGO74QN8DHA.2796@TK2MSFTNGP09.phx.gbl...
    I think there are a few minor differences but most of OLEDB is a superset,
    IIRC. In other words, switching to OLEDB from ODBC, you are very unlikely
    to lose any functionality. In fact, I think it is very doubtful that any
    differences will be noticeable in an ASP application.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    "Laphan" <news@DoNotEmailMe.co.uk> wrote in message
    news:uEiHdNN8DHA.2416@TK2MSFTNGP10.phx.gbl...
    > Dear Guys
    >
    > Thanks for the feedback on this.
    >
    > Can I ask that once I have made a successful connection does the
    Connection,
    > Command and Recordset commands under OLEDB work in exactly the same way as
    > the ODBC one?
    >
    > Rgds
    >
    > Laphan
    >
    > Jeff Cochran <jcochran.nospam@naplesgov.com> wrote in message
    > news:402943fc.3983397@msnews.microsoft.com...
    > On Tue, 10 Feb 2004 14:31:45 -0600, Turkbear <noone@nowhere.com>
    > wrote:
    >
    > >On Tue, 10 Feb 2004 19:29:21 GMT, [email]jcochran.nospam@naplesgov.com[/email] (Jeff
    > Cochran) wrote:
    > >
    > >>On Tue, 10 Feb 2004 11:39:14 -0500, "Aaron Bertrand - MVP"
    > >><aaron@TRASHaspfaq.com> wrote:
    > >>
    > >>>Oh come on, show us your real password. :-)
    > >>
    > >>Umm... I did... Doesn't *everyone* use "password" as a password? Or
    > >>do you make it hard by using an upper case P...? :)
    > >>
    > >>Jeff
    > >
    > >Actually I try to make it descriptive : pASSword
    >
    > We used to have a database for employee titles with a limited length.
    > Somehow the promotion to Senior Network Ass didn't impress me as much
    > as the boss thought it should...
    >
    > Jeff
    > (Former Title: Senior Network Associate)
    >
    >



    Laphan Guest

  14. #13

    Default Re: Working OLE DB string for an Access DB

    > I was just worried that a command such as making the connection
    client-side
    > for paging (this is right isn't it?), would be different.
    I have no idea what you're talking about...

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand - MVP Guest

  15. #14

    Default Re: Working OLE DB string for an Access DB

    > > I was just worried that a command such as making the connection
    > client-side
    > > for paging (this is right isn't it?), would be different.
    >
    > I have no idea what you're talking about...
    Sorry, this was a little harsh, I thought your comment had to do with
    shopping carts (how do you keep track of so many threads you've started???).

    I never "make the connection client-side for paging" but I'm pretty sure the
    technique will be the same for both OLEDB and ODBC. You could always try it
    with your existing code, you'll get a definitive answer faster than an
    opinion from here.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand - MVP Guest

  16. #15

    Default Re: Working OLE DB string for an Access DB

    Laphan wrote:
    > Thanks for the prompt reply Aaron.
    >
    > I was just worried that a command such as making the connection
    > client-side for paging (this is right isn't it?), would be different.
    >
    There is no reason that it would be different. You are talking about setting
    properties (CursorLocation, etc.) of "ADO recordsets", not "ODBC ADO
    recordsets" or "OLEDB ADO recordsets". All of these properties and their
    settings (aka enumerations) are contained in the ADO library, which is
    totally separate from the ODBC and OLEDB libraries.

    So the settings will not change. What may vary from one provider to another
    is the ability of the provider to implement the desired setting. In the case
    of Access and SQL Server, however, this is not an issue. When you get into
    third-party databases and providers, then you may run into issues.

    HTH,
    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  17. #16

    Default Re: Working OLE DB string for an Access DB

    Sorry for the frantic posting, but when I'm on one, I'm basically on one.

    Just to finish this thread, I though it was interesting that you said that
    you don't use paging to show records on your ASP pages. I didn't know there
    was a different way of doing this or do you simply not do the '10 products
    per page' scenario?

    Rgds

    Laphan


    Aaron Bertrand - MVP <aaron@TRASHaspfaq.com> wrote in message
    news:uc1Xi5N8DHA.4060@tk2msftngp13.phx.gbl...
    > > I was just worried that a command such as making the connection
    > client-side
    > > for paging (this is right isn't it?), would be different.
    >
    > I have no idea what you're talking about...
    Sorry, this was a little harsh, I thought your comment had to do with
    shopping carts (how do you keep track of so many threads you've started???).

    I never "make the connection client-side for paging" but I'm pretty sure the
    technique will be the same for both OLEDB and ODBC. You could always try it
    with your existing code, you'll get a definitive answer faster than an
    opinion from here.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    Laphan Guest

  18. #17

    Default Re: Working OLE DB string for an Access DB

    > you said that
    > you don't use paging to show records on your ASP pages.
    When did I say that? I said I don't "make the connection client-side"...
    see [url]http://www.aspfaq.com/2120[/url]


    Aaron Bertrand [MVP] Guest

  19. #18

    Default Re: Working OLE DB string for an Access DB

    Sorry Aaron

    Newbie piffle came out of my fingers.

    Was I close to the mark in my follow up post re eCommerce/Shopping Cart
    Experience?

    Rgds

    Laphan

    "Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
    news:%23$fkMtW8DHA.1816@TK2MSFTNGP12.phx.gbl...
    > you said that
    > you don't use paging to show records on your ASP pages.
    When did I say that? I said I don't "make the connection client-side"...
    see [url]http://www.aspfaq.com/2120[/url]



    Astra Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139