P
pamelafluente
Hi I am executing some simple sample code:
Using OleDbCommand As New OleDbCommand(Me.DBQuery.Text,
Me.OleDbConnection)
Dim OleDbParameter As OleDbParameter =
OleDbCommand.Parameters.Add("@Pinco", OleDbType.VarWChar)
OleDbParameter.Direction = ParameterDirection.Input
OleDbParameter.Value = "Berlin"
Using OleDbDataReader As OleDbDataReader =
OleDbCommand.ExecuteReader()
'...
I use this query:
SELECT
C.Country AS "Country",
C.City AS "City"
FROM
Customers C
where
C.City = @Pinco
It works with ACCESS, but gives error with SQL Server (says variable
has not been defined).
What's the problem here? How do I fix it to work with a general OleDB
connection?
-P
Using OleDbCommand As New OleDbCommand(Me.DBQuery.Text,
Me.OleDbConnection)
Dim OleDbParameter As OleDbParameter =
OleDbCommand.Parameters.Add("@Pinco", OleDbType.VarWChar)
OleDbParameter.Direction = ParameterDirection.Input
OleDbParameter.Value = "Berlin"
Using OleDbDataReader As OleDbDataReader =
OleDbCommand.ExecuteReader()
'...
I use this query:
SELECT
C.Country AS "Country",
C.City AS "City"
FROM
Customers C
where
C.City = @Pinco
It works with ACCESS, but gives error with SQL Server (says variable
has not been defined).
What's the problem here? How do I fix it to work with a general OleDB
connection?
-P