I need to display the results of a stored procedure in gridview using a checkbox. But my result set is not tied to gridview as I am working on an existing portal that has connection strings embedded in the dll. Here is my code ..
protected void Go_Rgn_Click(object sender, EventArgs e)
{
SecurityController SC = new SecurityController();
plhTable.Visible = true;
plhChoose.Visible = false;
plhForm.Visible = false;
string Rgn = afRgn.Text;
DataTable dt = new DataTable();
dt=SC.BindGridView(Rgn);
if (dt.Rows.Count > 0)
{
gvAll.DataSource = dt;
gvAll.DataBind();
}
}
The compiler produces an error that
Cannot convert void type to System.Data.DataTable
Please advise me about this.
Data level:
public DataTable BindGridView(string rgn)
{
string spdName = "spd_get_default_region";
DbCommand cmd = DB.GetStoredProcCommand(spdName);
DB.AddInParameter(cmd, "Rgn", DbType.String, rgn);
return DB.ExecuteNonQuery(cmd);
}
source
share