Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Problem with Access db from ASP using ADO


Message #1 by "Ozgur" <zanoz@y...> on Wed, 11 Oct 2000 10:20:09 +0100
I have two access databasea one for online, one for offline. Online

database responds to requests from Internet with ASP via ADO. Offline

database is being updated and copied onto the online one after changes are

completed.



My problem is that when a connection is established to online database i

can NOT copy(overwrite) my offline database to my online database because

there is still a connection from internet and the .ldb file of the

corresponding database file is seen. I would like to copy it wihout any

problem.



I used ASP such as:

Should we need to open database with some kind of cursor or lock type in

order to prevent the copy failure when offline database is being copied

(overwrite) to online database?



<%

Set rs = Server.CreateObject("ADODB.Recordset")

strConn = "Driver={Microsoft Access Driver (*.mdb)};

DBQ=c:\MyDatabase.mdb"

SQL = "Select * from MyTable"

 rs.open SQL, strConn

.....

rs.close

Set rs = Nothing

%>

Thanks,

Ozgur

Message #2 by "Jon S. Jaques" <jjaques@g...> on Wed, 11 Oct 2000 16:11:41 -0400
Hi...



I feel for you, I've been there before; Twice.



Once, I solved the problem once by using MS Replication. I had a database

that I used to do the database design work, and that was the Master, and

then I had a slave on both the webserver (which was local to me, as I had

the web servers on my network) and another slave at the dataentry station.



Then, daily, I ran a VB app which had code that was a variant of this:



sub replicate()

On Error GoTo Err

    Dim DBS As Database

    DoCmd.Hourglass True

    Set DBS = CurrentDb()

    ' Sends changes made in each replica to the other.

    DBS.Synchronize "\\REPORTS\usr\appCalendar\calendar.mdb", _

        dbRepImpExpChanges

    DBS.Close

    DoCmd.Hourglass False

func_Exit:

    Exit Sub

Err:

    DoCmd.Hourglass False

    MsgBox Error$

    Resume func_Exit

end sub



This can also be made to work with a remote server over the internet, but I

never had any luck.



The next time, I HAD to do it over the internet, but this time, I had a SQL

server available to me, so I used the upsizing wizard in Access, and that

moved all of the tables and data to the server, and then there was no more

reason to have to move the .mdb file around (because it was then a

client/server application). The only downside is that you need to be

connected to the internet in order to be able to do dataentry into the db.



Hope this helps!



--Jon S. Jaques





> -----Original Message-----

> From: Ozgur [mailto:zanoz@y...]

> Sent: Wednesday, October 11, 2000 5:20 AM

> To: ASP Databases

> Subject: [asp_databases] Problem with Access db from ASP using ADO

>

>

> I have two access databasea one for online, one for offline. Online

> database responds to requests from Internet with ASP via ADO. Offline

> database is being updated and copied onto the online one after changes are

> completed.

>

> My problem is that when a connection is established to online database i

> can NOT copy(overwrite) my offline database to my online database because

> there is still a connection from internet and the .ldb file of the

> corresponding database file is seen. I would like to copy it wihout any

> problem.

>

> I used ASP such as:

> Should we need to open database with some kind of cursor or lock type in

> order to prevent the copy failure when offline database is being copied

> (overwrite) to online database?

>

> <%

> Set rs = Server.CreateObject("ADODB.Recordset")

> strConn = "Driver={Microsoft Access Driver (*.mdb)};

> DBQ=c:\MyDatabase.mdb"

> SQL = "Select * from MyTable"

>  rs.open SQL, strConn

> .....

> rs.close

> Set rs = Nothing

> %>

> Thanks,

> Ozgur

>

> ---

> NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?

> Visit EarthWeb for the latest in IT Management, Software Development,

> Web Development, Networking & Communications, and Hardware & Systems.

> Click on http://www.earthweb.com for FREE articles, tutorials,

> and discussions from the experts.

> ---




  Return to Index