SqlCeServer parameters issue

  • Thread starter Thread starter Chuck Hecht
  • Start date Start date
C

Chuck Hecht

I am attempting to get my dataset records into a sqlce database.
I am using a parameterized query but keep getting the same sqlce error:

Hresult -2147217900
Native error 25501
Message: "there was an error parsing the query token line number, token line
offset, token in error"

The error always occurs on the cmd.prepare()

Dim indexOfTable As Integer = dsTraker.Tables.IndexOf("sbcdefs")
If (indexOfTable < 0) Then
'table not found
Return
End If
Dim indexOfItem As Integer =
dsTraker.Tables(indexOfTable).Columns.IndexOf("pkey")
If (indexOfItem < 0) Then
'field was not found
Return
End If
Dim x As Integer = 0
Dim i As Integer = 0
i = dsTraker.Tables("sbcdefs").Rows.Count

'cmd.Parameters.Add("@pkey",
Val(dsTraker.Tables(indexOfTable).Rows(x).Item(indexOfItem)))
cmd.Parameters.Add("@title", SqlDbType.NVarChar, 20)
cmd.Prepare()
For x = 0 To i - 1
cmd.Parameters.Item(0).Value =
dsTraker.Tables(indexOfTable).Rows(x).Item(indexOfItem)
cmd.ExecuteNonQuery()
Next
 
Back
Top