|
-
Aug 22nd, 2000, 12:58 AM
#1
please help! my boss is back in office tomorrow and I need a solution
I used an Access-Db via jet in the last five projects without any problems.
Now I should access the db via odbc and it doesn't work just as fine.
It's no problem to read data out of the tables but I'm not able to update or edit them.
Vb always complains that my db is write protected.
Code:
Dim wks As Workspace
Set wks = CreateWorkspace("wksTest", "Admin", "admin", dbUseODBC)
Dim dbs As Database
Set dbs = wks.OpenDatabase("Test", dbDriverNoPrompt, False, "ODBC;DSN=Test;")
Dim rsTest As Recordset
Set rsTest = dbs.OpenRecordset("SELECT * FROM Test", dbOpenDynaset)
With rsTest
.Edit
'runtime-error 3027
!strData = "Edited"
.Update
End With
With rsTest
.AddNew
'runtime-error 3027
!strData = "New"
.Update
End With
'works well
While (Not (rsTest.EOF))
Debug.Print rsTest!strData
rsTest.MoveNext
Wend
Debug.Print dbs.Updatable
'prints true
Debug.Print rsTest.Updatable
'prints false
Dim fld As Field
For Each fld In rsTest.Fields
Debug.Print fld.Name, CStr(fld.DataUpdatable)
'prints false
Next fld
thanks in advance
__________________
da_bob
vb6 enterprise, sp3, nt
-
Aug 22nd, 2000, 01:14 AM
#2
Lively Member
I dont use Access but I suggest :
Set rsTest = dbs.OpenRecordset("SELECT * FROM Test", dbOpenDynaset,,dbOptimistic )
Because I think that the default for lockedits are dbReadOnly.
Yesterday, all my troubles seemed so far away...
Help, I need somebody, Help...
Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.
-
Aug 22nd, 2000, 01:19 AM
#3
thanks for your reply but it didn't work either
The OpenRecordset with dbOptimistic resulted in
runtime error 3001.
_________________
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|