Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 10th, 2003, 10:16 PM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to PHANI KISHOREKOTTAPALLI Send a message via Yahoo to PHANI KISHOREKOTTAPALLI
Default ASP with MS ACCESS

Hi,

I want to know how to give odbc or oledb connection from asp to MS

Access. Many one are saying asp not support ms asccess as it supports

to Oracle, is it correct?

Regards

kishore.k

 
Old July 11th, 2003, 03:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

ASP can certainly connect to Access, like this (just change the bit in red to substitute the path to your database)
Code:
 
    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
              "Data Source=" & Server.MapPath("db\myDb.mdb") & ";" & _
              "User Id=admin;" & _
              "Password="
 
Old July 26th, 2003, 12:54 AM
arp arp is offline
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ASP definately supports MS Access since both are Microsoft products. Here is another way to connect MS Access database through ASP. Replace variable in RED with your values.

set con = Server.Createobject("ADODB.connection")
connStr= "DRIVER={Microsoft Access Driver (*.mdb)};"& _
             "DBQ=" & server.mappath("myDB.mdb") & ";UID=userid;PWD=password"

con.Open connStr

:) ARP

 
Old July 28th, 2003, 06:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi arp,

I think you should be aware that this is not a good connection string for Access from ASP. Your example uses the Access ODBC driver which is not recommended for ASP. You should always use the native Jet OLEDB provider from ASP.

See MSKB article 222135 for details.

regards
Phil
 
Old July 28th, 2003, 07:07 AM
arp arp is offline
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Phil,

I am very thankful to you for this reply. I know JET OLEDB providers, But never able to figure out when to use ODBC or Jet OLEDB in ASP. You have provided information which I was looking for. It helped me a lot in my work.

Thank you

Regard,
arp :)

 
Old May 10th, 2005, 09:55 AM
Registered User
 
Join Date: Apr 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to cbrknight1
Default

Hi guys I creaded test.mdb MS ACCESS DATABASE . when I am trying to connect using
Dim dbconn, sql, dbcomm
        dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & _
                                      "Data Source=" & Server.MapPath("test.mdb") & ";" & _
                                        "User Id=admin;" & _
                                        "Password=")
        dbconn.Open()

As you posted arlier I get error:
Unspecified error
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Unspecified error

PLEASE HELP . I HAVE TRIED EVERYTHING

--Alex Z.
 
Old May 10th, 2005, 06:53 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

I havnt used access for some time, this is a currently working connection string:

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\wwwroot\rootDir\DB\name.md b"

A good resource www.connectionstrings.com
BTW: Dont forget to give the IUSER the correct permissions to the dir where the .mdb file is

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET with MS Access help ayazhoda ASP.NET 2.0 Professional 1 April 5th, 2007 08:13 AM
Access issues with ASP and a MS Access Database rj_conceptsnrec.com Classic ASP Databases 2 May 19th, 2005 12:44 PM
MS Access & ASP [email protected] Classic ASP Databases 0 January 12th, 2005 02:49 PM
access MS-Exchange through ASP ashoo Classic ASP Basics 1 July 5th, 2004 01:58 PM
Cycling through each record in ASP with MS Access imercha ASP.NET 1.0 and 1.1 Basics 1 March 29th, 2004 02:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.