Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Copying Records from a Large DB to anothe
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Copying Records from a Large DB to anothe

 Post Reply Post Reply
Author
fark View Drop Down
Newbie
Newbie


Joined: 04 November 2003
Location: United States
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote fark Quote  Post ReplyReply Direct Link To This Post Topic: Copying Records from a Large DB to anothe
    Posted: 04 November 2003 at 11:07am
I'm trying to copy records from one large Access DB (1000 Records) and adding them to another DB. I keep getting Unspecified errors because I think I'm using to many resources. I'm looking for suggestions on how to solve this problem. I'm not even sure what questions to ask. I'm limited to Personal Web Server because I'm running Win98 and my company isn't going to spend any money on software. Is there anything free out there that will work better and run on win98? I know I'm asking for a lot and there may be nothing I can do but I'm out of ideas. Thanks so much for all the help I've gotten here.
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2003 at 2:38pm
1000 records is not much, you can just export the data from one mdb to another. No web server needed.
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2003 at 2:54pm
You could also write a quick ASP script to loop through the records adding them to the other access database
Back to Top
fark View Drop Down
Newbie
Newbie


Joined: 04 November 2003
Location: United States
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote fark Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2003 at 4:04pm

I know that a 1000 records isn't that much but I just can't get my script to work with that many.  Maybe if I post the code.  This code works fine for the first 60 records and then stops with:

Microsoft JET Database Engine error '80004005'

Unspecified error

/convertups.asp, line 76

Am I opening something wrong?  Am I using the resources wrong?  I've tried a lot of different things and am stumped for something else to try.  Thanks for your help.


<!-- #include file="aspfunc.inc" -->
<%
Response.Write "TEST"
Const DSN_NAME = "DSN=UPS Tracking"
Dim dcUPS, rsUPS
Dim ConFields
Dim recordid
Dim fieldname(), value()
Dim strSQL
Dim strSQL1

Const DSN_SD = "DSN=Shipping Database"
Dim dcSD
Set dcSD = Server.CreateObject("ADODB.Connection")
dcSD.ConnectionTimeout = 4
dcSD.CommandTimeout = 2
dcSD.Open DSN_SD

Dim rsSD

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

 strSQL1= "SELECT * FROM UPS;"
 rsSD.Open strSQL1, dcSD, adOpenKeyset, adLockPessimistic

 ConFields=LoadFile("convertups.con")
 Set dcUPS = Server.CreateObject("ADODB.Connection")
 dcUPS.ConnectionTimeout = 4
 dcUPS.CommandTimeout = 2
 dcUPS.Open DSN_NAME, DSN_USER, DSN_PASS
 Set rsUPS = Server.CreateObject("ADODB.Recordset")

 strSQL = "SELECT * FROM calPackage, calPkgAccessory, calShipment, calPkgAgent WHERE calPackage.m_primaryKey = calPkgAccessory.m_foreignKey AND calPackage.m_foreignKey = calShipment.m_foreignKey AND calShipment.m_foreignKey00 = calPkgAgent.m_primaryKey;"

 rsUPS.Open strSQL, dcUPS, adOpenStatic, adLockReadOnly

Do While Not rsUPS.EOF
 recordid=checkduplicate(rsUPS.Fields("Sm_trackingNo"))
 If recordid<>0 Then
  ReDim fieldname(UBound(ConFields)/2)
  ReDim value(UBound(ConFields)/2)
  I=0
  T=1
  Do While I<UBound(fieldname)
   fieldname(I)=ConFields(T)
   value(I)=CStr(rsUPS(ConFields(T-1)))
   T=T+2
   I=I+1
  Loop

  rsSD = storeshipfield (rsSD, fieldname, value)

 End If
 rsUPS.MoveNext
Loop
 rsSD.Update
 rsSD.Close
 Set rsSD = Nothing
 rsUPS.Close
 Set rsUPS = Nothing
 dcUPS.Close
 Set dcUPS = Nothing

Response.Write "END"

Function checkduplicate(trackingnumber)
Dim rsSD
Dim strSQL
Dim NewID
Dim DB_CONNECTIONSTRING
DB_CONNECTIONSTRING = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Shipping Database\shippingdatabase.mdb;"
Set rsSD = Server.CreateObject("ADODB.Recordset")

 strSQL= "SELECT * FROM UPS WHERE TrackingNumber = """ & trackingnumber & """;"
 rsSD.Open strSQL, DB_CONNECTIONSTRING, adOpenFowardOnly, adLockReadOnly
 
 If rsSD.EOF Then
  rsSD.Close
  Set rsSD=Nothing
  checkduplicate=1
 Else
  rsSD.Close
  Set rsSD=Nothing
  checkduplicate=0
 End If

End Function

Function storeshipfield(rsSD, fieldname, value)
 rsSD.AddNew 'Line 90
 rsSD("ParcelCarrier")="UPS"
 
 For I=0 To UBound(fieldname) - 1
  rsSD(fieldname(I))=CStr(value(I))
 Next
 Response.Write "Record " & rsSD("ID") & " Updated <BR>"
 storeshipfield=rsSD
End Function
%>

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 05 November 2003 at 11:44am
Way to complicated. Use an append query like:

INSERT INTO newtable IN 'c:\dir\newdatabase.mdb'
SELECT *
FROM Table;
while you are connected to the old database
Back to Top
fark View Drop Down
Newbie
Newbie


Joined: 04 November 2003
Location: United States
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote fark Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2003 at 7:31am
Thanks, that's what I needed to know.  I figured there was probably a way that was 10 times easier.  I'm new to both asp and sql so I didn't really know about the INSERT Statement.  Thanks
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.