I am pulling my hair, trying to understand that I canβt get the parameters for working in my request. I have code written in VB.NET that is trying to fulfill a request to AS / 400. I have installed IBM Access for Windows, and I can make requests work, not with parameters. Every time I include a parameter in my request (e.g. @MyParm), it does not work. It does not seem to replace the parameter with the value that it should be. Here is my code:
I get the following error: SQL0206: The @MyParm column is not listed in the tables
Here is my code:
Dim da As New OleDbDataAdapter
Dim dt As New DataTable
da.SelectCommand = New OleDbCommand
da.SelectCommand.Connection = con
da.SelectCommand.CommandText = "SELECT * FROM MyTable WHERE Col1 = @MyParm"
With da.SelectCommand.Parameters
.Add("@MyParm", OleDbType.Integer, 9)
.Item("@MyParm").Value = 5
End With
' I get the error here of course
da.Fill(dt)
I can replace @MyParm with the letter 5 and it works fine. What am I missing here? I do this with SQL Server all the time, but this is the first time I am trying to do this on an AS400.