Hi,
I don't know why i am getting this error.

Please see my coding part, where i am facing this following error

Private pbat  As New ADODB.Parameter

            'in form load
              With pbat
             .Direction = adParamInput
             .Type = adVarChar
             .Size = 4
              End With 

             'saving part 
            [B]  pbat = Trim(Text1.Text) & "%"[/B] -here i faced the following error

How to rectify this error ?

to which property of the object you are assigning that string ?

"pbat" is the parameter - appending to "SQL Select Query"

Private pbat  As New ADODB.Parameter
[B]pbat = Trim(Text1.Text) & "%"[/B]

-here i faced the following error

perhaps ???

pbat.value = Trim(Text1.Text) & "%"

Still i am facing the same error:

Run time error: '3421'
Application uses a value of the wrong type for the current operation

Why i am facing this error?

There is a parameter expected in your SQL statement (which we have not seen). Please show the SQL statement, and the surrounding VB used to construct it. My guess is that your statement is using ODBC syntax incorrectly, so your driver is trying to interpret your varchar as an int. Cleaner way might be to just dynamically construct the SQL statement as a string and do away with the Parameter object altogether.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.