error
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0103: The name 'id' does not exist in the current context
Source Error:
Line 41: {
Line 42: //Int32 id;
Line 43: BindDatalist(username, id);
Line 44:
Line 45: }
code
protected void Page_Load(object sender, EventArgs e)
{
if (this.Page.User.Identity.IsAuthenticated)
{
string username = this.Page.User.Identity.Name;
int id ;
// Session["Name"] = Session["Name"].ToString();
if (!IsPostBack)
{
//Int32 id;
BindDatalist(username, id);
}
}
}
public void BindDatalist(string username, int id)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlDataAdapter adp = new SqlDataAdapter("GetMessage", con);
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
adp.SelectCommand.Parameters.AddWithValue("@UserName", username );
adp.SelectCommand.Parameters.AddWithValue("@Id", id);
DataTable dt = new DataTable();
adp.Fill(dt);
if (dt.Rows.Count > 0)
{
GetMergedAll.DataSource = dt;
GetMergedAll.DataBind();
}
}