Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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 June 23rd, 2003, 01:08 PM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default runtime error 3260

can anyone help with this error, i'm loading records from a .csv file into an .mdb, I get this error after about 3500 records.
seems to be completely random but always after 3500 records and i have 140000 to import.

runtime error 3260

could not update; currently locked by user 'admin' on machine 'xp2000'.

any help appreciated.

Chris :D:D
 
Old June 23rd, 2003, 02:06 PM
Registered User
 
Join Date: Jun 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Chris,
How are you adding these records ? with .add & .update ?

If so Microsoft added a locking mechanism on Access 2000 if you constantly open and close a table.

You may be better off creating an ADO connection to the CSV file and then

"INSERT INTO {table} (Field1,...) SELECT * FROM data.CSV"
 
Old June 23rd, 2003, 03:50 PM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Phil, yes i am using add and update and it took me months to work out how to do it.
not done much with ADO and haven't got a clue where to start.
Any good tutorials?
 
Old June 23rd, 2003, 08:48 PM
Authorized User
 
Join Date: Jun 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I can give you some pointers with ADO =o)
It is amazingly helpfull if you have a little knowledge of SQL when using ADO, but not neccessary..

first add "Microsoft Active Data Objects" from the reference list(i.e. ADO).

ADO functions primarily from two objects you declare, one is the connection, and one is the recordset. you only have to mess with the connection for a short while..so I won't focus on it too extensivly.

to start, go ahead and dim your main ado objeccts...

Dim adoRecordSet as new ADODB.RecordSet
Dim adoConnection as new ADODB.Connection

a few preliminary settings you want that apply to almost all projects..

adoRecordset.CursorLocation = adUseClient <--- this is important =o)

now you open the connection(the recordset runs through the connection to the database).

there are a few ways to open your ADO connection, using the vb6 wizard for database connectivity..tell it to generate you a "string", or you can build your own conneection string
below is a generic string to connect to a sql server.

adoConnection.Open "Provider=SQLOLEDB;Driver={SQL Server};Persist Security Info=False; Mode=Read|Write;uid=USERNAME;pwd=PASSWORD;server=m ysqlserver.com;database=mysqldatabase"

when that line is executed, your connections would open a link to a SQL database named 'mysqldatabase' at the network address 'mysqlserver.com', and try to login to it with USERNAME & PASSWORD.

That's all for the connection, now your recordset...we'll use a generic one that would return all the entries within a table.

adoRecordSet.Open "SELECT * FROM MYTABLE ORDER BY NAME", adOpenDynamic, adOpenLockOptimistic

now our recordset object can access all the records from "mytable", and they will be in order of the field "Name" in your database..the ORDER BY statement is completely optional.

to access them...you would use a bit of code like this:

adoRecordSet.MoveFirst 'this moves to the first record returned

Msgbox "Customers' Name: " & adoRecordSet!NAME
msgbox "Customers' Phone #" & adoRecordSet!PHONENUMBER

If you need to change a value in your recordset, do something liek this

adoRecordSet!NAME = "Bob's New Name"
adoRecordSet!PHONENUMBER = "555-555-5555"
adoRecordSet.Update 'this saves the current record

For your conversion, you could have 2 connection objects, one conneect to the new database, one conneccted to the old, and two recordsets...then just do something like this..

do while <> OldRecordSet.EOF
  SoFar = SoFar + 1
  NewRecordSet!Name = OldRecordSet!Name
  NewRecordSet!Phone = OldRecordSet!Phone
  NewRecordSet.Update
  OldRecordSet.MoveNext
  NewRecordSet.AddNew 'would create a new entry
  lblprogress.caption = soFar & " from " & OldRecordSet.RecordCount
  doevents
loop


At the end, just remember to do .Close on your recordsets, then your connections. I hope this has been helpfull, also, at http://msdn.microsoft.com/library/de...conversion.asp you can find documentation on ADO references & ADO objects.

~hunter
 
Old June 24th, 2003, 01:59 AM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Excellent, thanks alot.

Chris





Similar Threads
Thread Thread Starter Forum Replies Last Post
hi i got runtime error 13 Type Mismatch error sriharsha345 Access VBA 2 February 21st, 2008 09:30 AM
runtime error??? jeffreyJS ASP.NET 2.0 Basics 4 September 14th, 2006 04:07 AM
mysterious error runtime error '451' coyotworks Excel VBA 1 May 12th, 2006 03:57 PM
Runtime Error rwiethorn ASP.NET 1.0 and 1.1 Basics 1 January 27th, 2004 02:01 PM
runtime error 3260? [email protected] VB How-To 4 June 24th, 2003 12:13 PM





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