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

Assign even odd page numbers in word

vba ms-word word-vba page-numbering

I am trying to write a vba macro for word, where the document will have page numbers, but the alignment of odd page number will be different from the even page. The code that I am presently trying is

How to scroll down a scrollview while scrolling from another scrollview in android?

java android xml scrollbar

I have two scrollview and I want to scroll any of the scrollview such that another scrollview also scroll down. Is is possible in android? If yes then how?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.