rs.Update not working

Please help me to resolve the rs.Update issue. Nothing is happening in the database after rs.Update
Dim db As New MySQLCommunityServer
db.Host = “localhost”
db.Port = 3306
db.DatabaseName = “new”
db.UserName = “root”
db.Password = “admin”
If db.Connect Then
Dim d As New Date
Dim ps As PreparedSQLStatement=db.Prepare("SELECT * FROM repgen WHERE dates = ? ")
ps.BindType(0, MySQLPreparedStatement.MYSQL_TYPE_STRING)
ps.Bind(0,str(d.SQLDate))
Dim rs As RecordSet = ps.SQLSelect
MsgBox(str(rs.Field(“dates”).StringValue))
If rs <> Nil Then
rs.Edit
rs.Field(“ev1”).StringValue =“2”
MsgBox(rs.Field(“ev1”).StringValue)
rs.Update
db.Commit
Else
If db.Error Then MsgBox(db.ErrorMessage)
End If
Else
If db.Error Then MsgBox(db.ErrorMessage)
End If

this is my code . I’m getting the values in the MsgBox but its not getting updated in the database .

why not do it the “easy way”

UPDATE repgen SET ev1=“2” where dates =

I’d recommend Dave’s suggestion as well.

As for why your code isn’t working, for one thing, you are not checking for errors after the commit, you’re only checking after the connect, and if the RecordSet is nil.

In addition to checking for rs <> Nil (an error condition), also check for Not rs.EOF (no records returned).