Little VB error - any takers?

Soldato
Joined
27 Jan 2005
Posts
3,137
Location
Versailles
Help please.....

vb6
run time error '-2147217900' [Microsoft][ODBCMicrosoftAccessDriver]Syntax error (missing operator) in query expression 'Pa_RaM000Where player_id = Pa_RaM001'

when running this code:

Private Sub update_btn_Click()

Dim adoCommand As ADODB.Command
Set adoCommand = New ADODB.Command

With adoCommand
.CommandType = adCmdText
.ActiveConnection = DB
.CommandText = "Update players " & _
"Set player_name = ?" & _
"Where player_id = ?"
End With


Dim adoParm_player_id As Parameter
Set adoParm_player_id = adoCommand.CreateParameter("player_id", _
adInteger, _
adParamInput)
Call adoCommand.Parameters.Append(adoParm_player_id)


Dim adoParm_player_name As Parameter
Set adoParm_player_name = adoCommand.CreateParameter("player_name", _
adVarChar, _
adParamInput, _
50)
Call adoCommand.Parameters.Append(adoParm_player_name)

adoParm_player_id.Value = Player.PlayerID
adoParm_player_name.Value = PlayerName.Text

Call adoCommand.Execute
Set adoCommand = Nothing

End Sub

<ColiN>

PS; as you know im crap with google, but did get one msg about permissions, didnt help - anything else i can check.
 
Last edited:
From what I can see try changing

.CommandText = "Update players " & _
"Set player_name = ?" & _
"Where player_id = ?"

to:

.CommandText = "Update players " & _
"Set player_name = '?'" & _
"Where player_id = '?'"

and see if that works.
 
cheers refresh for your suggestion. it got rid of the error, however I've now got another one! It's now throwing error code -2147217887 Multiple step OLE DB operation generated errors. Check each OLE DB status value, if available.

Note, I didn't put the single quotes around the player_id as thats an integer value.

Thanks,

ColiN
 
Back
Top Bottom