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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -