en internet encontre un ejemplo para crear registros en una base de datos por medio de una transaccion (SQL), tema que me mantiene ocupado desde hace un buen tiempo, pero justo ahora cuando encuentro un ejemplo me aparece que un error:
![](http://img402.imageshack.us/img402/6230/errorworkspace.th.jpg)
Uploaded with ImageShack.us
el codigo es este y parece que esta hecho para vb4
Código:
(http://support.microsoft.com/kb/146908/es)Private Sub Form_Load() Dim Starttime, Endtime Dim db As Database Dim t As Recordset Dim i As Integer Dim tempName As String Dim temphone As String Set db = Workspace(0).OpenDatabase("c:\vb\BIBLIO.MDB") ' Uses a ' copy of BIBLIO.MDB. Set t = db.OpenRecordSet("Publishers", dbOpenTable) Starttime = Now 'BeginTrans ' Add this and CommitTrans (below) for greater speed. For i = 1 To 100 tempName = "testname" & Str$(i) ' Make an arbitrary unique ' string. tempPhone = Str$(i) ' Make arbitrary number. t.AddNew ' AddNew clears copy buffer to prepare for new record. t!PubID = 30 + i ' Set primary key to unique value. t!Name = tempName ' Set Name field to unique value. t!Telephone = tempPhone ' Set Telephone field to unique value. t.Update ' Write the record to disk or to transaction buffer. Next i 'CommitTrans ' Add this and BeginTrans (above) for greater speed. Endtime = Now MsgBox "Time required= " & Format(Endtime - Starttime, "hh:mm:ss") t.Close db.Close End End Sub
Debo mencionar que también agregue los siguientes recursos al proyecto:
Microsoft ActiveX Data Objects 2.0 Library
Microsoft DAO 3.51 Object Lirary
Microsoft Data Binding Collection
Microsoft Data Formating Object Library
estos recursos los tengo en otro ejemplo que maneja una base de datos de forma parecida.
talvez lo que hace falta es agregarle otro recurso pero cual o que es lo que esta mal?
gracias.