Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Error parsing the query -DBCC

$
0
0
Hello guys. I have an error: I want when I delete a row and if was only one to reseed the ID so I created this:
Function ReseedTable(ByVal TableName As String, ByVal Value As Integer)
        Dim cmd As SqlCeCommand = conn.CreateCommand()
        Try
            cmd.CommandText = "DBCC CHECKIDENT('" & TableName & "', RESEED, " & Value & ")"
            MsgBox(cmd.CommandText)
            cmd.Prepare()
            cmd.ExecuteNonQuery()
        Catch ex As Exception
            MsgBox(ex.Message & "Eroare46754563453534534")
        End Try
        Return 1
    End Function

And using this in the button if the table have no row:
ReseedTable(TableName, 1)

And I have this error:

Quote

There was an error parsing the query. [ Token line number = 1, Token line offset = 1, Token in error = DBCC ]

I have a SQL CE table.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>