I encountered this very strange problem on my laptop.
Environment:
Visual Basic 6 SP4
DAO 3.6
Microsoft Jet 4.0 SP6
Microsoft SQL Server 7 SP3 Desktop version
Window 98 Second edition
Purpose:
Update SQL server data via DAO/ODBC/JetWorkSpace
Code:
Dim engTest As DBEngine
Dim wksTest As Workspace
Dim dbsTest As DAO.Database
Dim rstTest As DAO.Recordset
Set engTest = New DBEngine
Set wksTest = DBEngine.CreateWorkspace("JetWorkSpace", "admin", "", dbUseJet)
Set dbsTest = wksTest.OpenDatabase(vbNullString, 0, 0, "ODBC;DSN=SQLTEST;"
Set rstTest = dbsTest.OpenRecordset("Select * from YZTEST", dbOpenDynaset)
rstTest.MoveLast
rstTest.MoveFirst
Debug.Print rstTest.RecordCount
rstTest.Edit
Set rstTest = Nothing
Set dbsTest = Nothing
Set wksTest = Nothing
Set engTest = Nothing
About Error 3228 "Selected collating sequence not suppored by the operationg system":
If I run this code in VB6 design envrionment for the very first time, I got this error on OpenRecordset method. Then if I click Debug button on the error dialog form, and click run Run/Start menu (F5), the program will open recordset without problem. From this point on, no error 3228 as long as I don't close VB environment. If close the VB environment and reopen VB and this project, the error 3228 occurs the very first time I run this code.
The error never occur if it is run outside VB
It seems some collating sequence was not set correctly. Once error 3228 occurs, VB correct this and remember the right settings.
I looks up Microsoft help, it talks about a Jet 4.0 Paradox settings in registry, it does not apply to this case, since the backend is desktop version of Microsoft SQL Server
Aoubt Error 3027 "Cannot update. Database or object is read-only"
The error occurs every time on Edit method.
I use SQL Authentication with a user name and password. The user is system administrator and database owner. I use the same user account and able to update data via Enterprise manager and Query analyzser.
I use the same user account and code (with different DSN and table name)to access a different database on the same SQL sever and encounter no problem.
Also the code is able to get correct record count which tells me the recordset is open ok with read-only atrribute.
Sorry for such long message.
Thank you for your time reading this. Any advice is sicerely appreciated!
Youdao
Environment:
Visual Basic 6 SP4
DAO 3.6
Microsoft Jet 4.0 SP6
Microsoft SQL Server 7 SP3 Desktop version
Window 98 Second edition
Purpose:
Update SQL server data via DAO/ODBC/JetWorkSpace
Code:
Dim engTest As DBEngine
Dim wksTest As Workspace
Dim dbsTest As DAO.Database
Dim rstTest As DAO.Recordset
Set engTest = New DBEngine
Set wksTest = DBEngine.CreateWorkspace("JetWorkSpace", "admin", "", dbUseJet)
Set dbsTest = wksTest.OpenDatabase(vbNullString, 0, 0, "ODBC;DSN=SQLTEST;"
Set rstTest = dbsTest.OpenRecordset("Select * from YZTEST", dbOpenDynaset)
rstTest.MoveLast
rstTest.MoveFirst
Debug.Print rstTest.RecordCount
rstTest.Edit
Set rstTest = Nothing
Set dbsTest = Nothing
Set wksTest = Nothing
Set engTest = Nothing
About Error 3228 "Selected collating sequence not suppored by the operationg system":
If I run this code in VB6 design envrionment for the very first time, I got this error on OpenRecordset method. Then if I click Debug button on the error dialog form, and click run Run/Start menu (F5), the program will open recordset without problem. From this point on, no error 3228 as long as I don't close VB environment. If close the VB environment and reopen VB and this project, the error 3228 occurs the very first time I run this code.
The error never occur if it is run outside VB
It seems some collating sequence was not set correctly. Once error 3228 occurs, VB correct this and remember the right settings.
I looks up Microsoft help, it talks about a Jet 4.0 Paradox settings in registry, it does not apply to this case, since the backend is desktop version of Microsoft SQL Server
Aoubt Error 3027 "Cannot update. Database or object is read-only"
The error occurs every time on Edit method.
I use SQL Authentication with a user name and password. The user is system administrator and database owner. I use the same user account and able to update data via Enterprise manager and Query analyzser.
I use the same user account and code (with different DSN and table name)to access a different database on the same SQL sever and encounter no problem.
Also the code is able to get correct record count which tells me the recordset is open ok with read-only atrribute.
Sorry for such long message.
Thank you for your time reading this. Any advice is sicerely appreciated!
Youdao