Subject | parametric queries from .NET |
---|---|
Author | Newbie |
Post date | 2012-07-25T00:26:47Z |
how to use parametric queries from .NET with Firebird?
I have always been using parameters with stored procedures. like this
FbCommand cmd = new FbCommand("select * from
SP_myprocedure(?);");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@myparameter", FbDbType.Text).Value =
myparameter;
this works very well. but now I have just a query where I need to add
several parameter inputs. I have changed the CommandType to Text and
tried adding parameter into query for example "select field1, field2
from table1 where field1=:myparameter;"
but can't get it to work. how should it be done?
I have always been using parameters with stored procedures. like this
FbCommand cmd = new FbCommand("select * from
SP_myprocedure(?);");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@myparameter", FbDbType.Text).Value =
myparameter;
this works very well. but now I have just a query where I need to add
several parameter inputs. I have changed the CommandType to Text and
tried adding parameter into query for example "select field1, field2
from table1 where field1=:myparameter;"
but can't get it to work. how should it be done?