Question

I Have Problem About this count Keyword after that appear that stuff

Here Code

Public Sub searchayumiKn()
    Dim myKeyWords() As String = TChat.Text.Split(" "c)
    Dim mySQLQuery As String = "SELECT AIRes FROM T_GKnowledge WHERE "
    Dim KeyWordCount As Integer

    For KeyWordCount = 0 To myKeyWords.Length - 1
        Dim strKeyParameter As String = String.Format("@Param{0}", KeyWordCount)
        Dim strWhereClause As String

        If KeyWordCount = 0 Then
            strWhereClause = String.Format("Keyword LIKE {0}", strKeyParameter)
        Else
            strWhereClause = String.Format(" OR Keyword LIKE {0}", strKeyParameter)
        End If
        mySQLQuery &= strWhereClause
        cmdhikari.Parameters.AddWithValue(strKeyParameter, String.Format("{0}{1}{0}", "%", myKeyWords(KeyWordCount)))
    Next

    With cmdhikari
        .CommandText = mySQLQuery
        .Connection = conayumi
    End With

    Try
        dthikari = New DataTable
        dahikari.Fill(dthikari)
        answers.DataBindings.Add("text", dthikari, "AIRes", True)
    Catch ex As Exception
        MsgBox(ex.Message, MsgBoxStyle.Critical, "Caution")
    End Try
    KeyWordCount = 0
    TChat.Clear()
    Return
End Sub

Got Error @param bla". can anyone delete this count? i just need original of data record. Not Count every time. just not using count. so freely record

Was it helpful?

Solution

move out from for this declaration

Dim strKeyParameter As String = String.Format("@Param{0}", KeyWordCount)
Dim strWhereClause As String

it's make duplicate declaration the same parameter

hopefully could be useful

regards Ade Nurhuda

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top