Re: ADO connection with VBS to locally stored MS-Access database

From: Val Mazur (group51a_at_hotmail.com)
Date: 02/28/05


Date: Mon, 28 Feb 2005 18:49:50 -0500

Hi,

Even using of the OLEDB Jet provider is better, I do not see any confusion
here. You could use ODBC or OLEDB syntax but in this case ADO will using
different providers to accomplish the task. If you are using ODBC syntax,
then ADO will use OLEDB for ODBC provider. I would suspect it could be some
issue related to the security when application does not have permissions to
work with the database file from ASP environment. I would suggest to try to
put some messages for the tracing and check actual error message for the Err
object to see what is going on here.

-- 
Val Mazur
Microsoft MVP
http://xport.mvps.org
"Peter Wetschnigg" <pwetsch@gmx.at> wrote in message 
news:n9858sqjvj5$.1gjb9bqi4edgg.dlg@40tude.net...
> Hello
>
> I am trying to connect to a local Access database via ADO and VB Script.
> The following code snippet is supposed to connect to a database and show
> the number of records in table1 in a message box
>
> ----------------------------------------
>
> <script type="text/vbscript">
>
> Dim oRS
> Dim oConn
> Set oConn = CreateObject("ADODB.Connection")
> oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & _
>           "DBQ=C:\MyDatabase.mdb;"
>
> oRS.Open "Select * FROM table1", oConn
>
> MsgBox oRs.RecordCount
>
> oConn.Close
> Set oConn = Nothing
> </script>
>
> ----------------------------------------
>
> But, when I load the html-document which contains this code into 
> Iexplorer,
> it crashes. :-( The database must have been opened, because a .ldb has 
> been
> created, which remains on the hard disk after the crash, but there still
> must be a mistake in the oConn.Open statement. Could anyone give me an
> advice?
>
> Best regards,
> Peter W. 


Relevant Pages

  • Re: Cannot display ODBC login prompt - want to connect without DSN
    ... ODBC was superseded thirteen years ago by OleDb: ... In this particular case, my program will conect to an Oracle database, but ... There does not seem to be a .NET provider for MS Access, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: create a data provider
    ... You can write a OLE DB Simple Provider in VB6 by implementing the ... _too_ simple for consumers like Excel 2007. ... ODBC or OLEDB wrapper for an ADO.NETdataprovider. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Word 2000/2002 - Proper Mail Merge steps for ODBC?
    ... > I don't get the "Database has been placed in a state by ... Access runs the query and will prompt for any ... > my ODBC entry and click the "Configure" button, ... >>using OLEDB, it uses a more exclusive mode than it really ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Waiting on OLEDB
    ... ODBC don't work correct, so you have to use native ODBC provider. ... > OLEDB, and waitresource has the name of my System DSN. ... > was able to resolve it by restarting SQL Server. ...
    (microsoft.public.sqlserver.server)
  • Re: Is there an ADO.NET driver for Sybase ASE 12.5?
    ... you needn't get a specific provider for a Sybase ... OleDb provider and ODBC provider can be used to connect. ... project and set the connection string property for the OleDbConnection. ...
    (microsoft.public.dotnet.framework.adonet)

Loading