Hi,
How can I use parameters in an SQL Server prepared statement?
I tried
Database.Connection conn = Database.Connection("BOPSO"); Database.PreparedStatement stmt = conn.prepareStatement("SELECT * FROM MyTable WHERE Id = @Id"); stmt.bindParam("Id", 1, Database.DataType.Int);
but that gives me "FlexScript exception: Bind variable/parameter 'Id' not found". When I replace @Id
by :Id
I get "FlexScript exception: API client not set" instead.