ShaneBrennan
Programmer
I'm having a problem adding a new record to my MySQL database.
I have a database called tblLog (Currently empty) with 3 fields: ClientID, ProductID and SecurityID - all varchar
All I want to do it add a new record, but the I keep getting the following error message:
"Run-time error '3027'" "Cannot update. Database or object is read-only."
I'm quite new to mySQL and connecting databases through VB6 (I Usually write all database applications with MS Access)
I'm sure I have set all the access rights/grant permissions correctly.
Below is a cut down version of the code, but the error occures on the rs.addnew command.
Any help would be gratefully received.
private sub InsertNewRow
Dim ws As Workspace
Dim db As Database
Dim rs As Recordset
Dim strConnection As String
strConnection = "ODBC;DSN=softwarelicense;UID=shane;PWD=frogger"
Set ws = CreateWorkspace("ODBCWorkspace", "", "", dbUseODBC)
Set db = ws.OpenDatabase("", False, False, strConnection)
Set rs = db.OpenRecordset("Select * from tblLog", dbOpenDynaset, dbExecDirect, dbOptimisticValue)
rs.AddNew
rs!ClientID = "Cli-0001"
rs!ProductID = "0123"
rs!SecurityID = "97661"
rs.Update
rs.Close
Set rs = Nothing
End Sub
Shane Brennan
'-----------------------
' Emails: shanebrennan@postmaster.co.uk
I have a database called tblLog (Currently empty) with 3 fields: ClientID, ProductID and SecurityID - all varchar
All I want to do it add a new record, but the I keep getting the following error message:
"Run-time error '3027'" "Cannot update. Database or object is read-only."
I'm quite new to mySQL and connecting databases through VB6 (I Usually write all database applications with MS Access)
I'm sure I have set all the access rights/grant permissions correctly.
Below is a cut down version of the code, but the error occures on the rs.addnew command.
Any help would be gratefully received.
private sub InsertNewRow
Dim ws As Workspace
Dim db As Database
Dim rs As Recordset
Dim strConnection As String
strConnection = "ODBC;DSN=softwarelicense;UID=shane;PWD=frogger"
Set ws = CreateWorkspace("ODBCWorkspace", "", "", dbUseODBC)
Set db = ws.OpenDatabase("", False, False, strConnection)
Set rs = db.OpenRecordset("Select * from tblLog", dbOpenDynaset, dbExecDirect, dbOptimisticValue)
rs.AddNew
rs!ClientID = "Cli-0001"
rs!ProductID = "0123"
rs!SecurityID = "97661"
rs.Update
rs.Close
Set rs = Nothing
End Sub
Shane Brennan
'-----------------------
' Emails: shanebrennan@postmaster.co.uk