I try to connect by ODBC 3.51 and I get connection and I can get data from MySQL database and show it in my VB 2008 Express Edition, but when I want to AddNew or Update something it gives me an error property "Item" is "ReadOnly" (about my rs).

This is my code and I do not know how to solve this problem.

Tel = Val(Me.TextBox1.Text)
ssql = "SELECT * FROM clientes where PENDIENTE='Y' AND TELEFONO= " & Tel & " "

conn = New ADODB.Connection
rs = New ADODB.Recordset
conn.CursorLocation = ADODB.CursorLocationEnum.adUseClient
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=localhost;" & "UID=root;" & "PWD=converged20;" & _
"DATABASE=callcenter01;" & "READONLY=0" & "OPTION=3"
conn.Open()
rs.Open(ssql, conn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)


rs.MoveFirst()
If rs.EOF Then
MsgBox("No existe registros de clientes ", 0)
Else
Me.TextBox14.Text = Me.DateTimePicker1.Text
rs.Fields("CITA") = Val(Me.TextBox14.Text)
rs.Update()
End If

Thanks in advance for your help.

Recommended Answers

All 6 Replies

i see the ; character after each setting but the readonly=0. Should it not be readonly=0; ?

I try with ReadOnly=1 and is the same result, it gives me the same error.

Please read my post more carefully

you need to call AddNew or Edit before using Update method.

I try without the "readOnly=0" in my connection string, but i have the same error, and I can call the rs.AddNew before rs.fields(xx) and the error persist and I can't find the rs.Edit, only find rs.EditMode but it gives me "Property acces must assign to the property or use its value"

You are missing the character ";" after your ReadOnly=0 as I can see it after each and every other named arguement but the readonly arg.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.