c# - SQLDatasource parameters -
how can set sql parameters sqldatasource in code behind? trying this:
int id=1; sqldatasource1.selectcommand = "select * categ id=@id"; sqldatasourcearticole.selectparameters.add("@id", id); // , this: sqldatasourcearticole.selectparameters.add("id", id);
but doesn't work? doing wrong?
make sure add select parameters before trying set default value.
i.e.
sqldatasourcearticole.selectparameters.add("@id", id); sqldatasourcearticole.selectparameters["id"].defaultvalue = id.tostring();
Comments
Post a Comment