Passing a custom sql command
Magezi Sagesse
DRCONGO
I have a problem with passing a custom sql command, I don't know how to pass parameters to tabledatasource selectcommand as it can be done with oledbcommand.parameters.add(.....), working without that is handling error when I the where condition data has an apostrophy.
Example: table.selectcommand="select * from listetous where objsup='l'homme'" with oledbcommand it works when I use parameter :
oledbcommand.commandtext= ="select * from listetous where objsup=a"
oledbcommand.parameters.add("a",oledbvarchar,255).value= "l'homme"
Can someone help me showing me how to use parameters with tabledatasource?
thank you!!!
Example: table.selectcommand="select * from listetous where objsup='l'homme'" with oledbcommand it works when I use parameter :
oledbcommand.commandtext= ="select * from listetous where objsup=a"
oledbcommand.parameters.add("a",oledbvarchar,255).value= "l'homme"
Can someone help me showing me how to use parameters with tabledatasource?
thank you!!!
Comments
I have gotten the solution :
what I did was to declare a fastreport commandparameter, I passed the value to that parameter and added the parameter to the tabledatasource paramtercollection
report1.Load("report1.frx");
TableDataSource table = report1.GetDataSource("Table1") as TableDataSource;
table.SelectCommand = "SELECT * FROM CUSTOMERS";
report1.Show();