SQLLite Update query Parameter not accepting System String value

I am having some issues with a parameterized SQL Lite query. I can't seem to get the SQL Lite Parameter to accept the String value

Using cmd As SQLiteCommand = pConn.CreateCommand()
    If tblLang = "en" Then
        cmd.CommandText = "UPDATE [AT_Strings] SET [Data] = @tblData + 1 WHERE [RecordID] = @ID AND [language] = @tblLang1"
        Dim tblData As New SQLiteParameter("@tblData")
        Dim ID As New SQLiteParameter("@ID")
        Dim tblLang1 As New SQLiteParameter("@tblLang1")
        cmd.Parameters.Add(dataText)
        cmd.Parameters.Add(ID)
        cmd.Parameters.Add(tblLang)
    Else
         cmd.CommandText = "UPDATE [AT_Strings] SET [Data] = @dataText + 1 WHERE [RecordID] = @ID AND [language] = @tblLang1"
         Dim tblData As New SQLiteParameter("@dataText")
         Dim ID As New SQLiteParameter("@ID")
         Dim tblLang1 As New SQLiteParameter("@tblLang1")
         cmd.Parameters.Add(dataText)
         cmd.Parameters.Add(ID)
         cmd.Parameters.Add(tblLang)
    End If

    cmd.ExecuteNonQuery()
 End Using

The error is as follows....

Unable to cast object of type 'System.String' to type 'System.Data.SQLite.SQLiteParameter'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Data.SQLite.SQLiteParameter'.

Source Error: 

Line 283:  Dim ID As New SQLiteParameter("@ID")

Line 284:  Dim tblLang1 As New SQLiteParameter("@tblLang1")

ERROR on Line 285...

Line 285:  cmd.Parameters.Add(dataText)

Answers


This is how I solved this issue...

Dim SqlString As String 
SqlString = "UPDATE [AT_Strings] SET [Data] = @Data WHERE [ID] = @ID AND [Language] = @Language"  

Using cmd As New SQLiteCommand(SqlString, pConn)    
    cmd.CommandType = CommandType.Text     
    cmd.Parameters.AddWithValue("Data", dataText)    
    cmd.Parameters.AddWithValue("ID", f4)    
    cmd.Parameters.AddWithValue("Language", tblLang)     

    pConn.Open()    
    cmd.ExecuteNonQuery()    
    pConn.Close() 
End Using 

Hope this helps someone else!!


Need Your Help

making a python bitarray from an integer - strange results!

python bit-fields bitarray

I'm just starting to use the bitarray package in python, and trying to make a bitarray from an integer gives me really confusing results:

wxWidgets (or even OOP GUI) Multiple Windows

c++ oop user-interface window wxwidgets

I'm kind of stuck on something; regarding spawning multiple forms in OOP.