error
Server Error in '/' Application.
Procedure or function 'GetUserPOSTS' expects parameter '@UserName', which was not supplied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Procedure or function 'GetUserPOSTS' expects parameter '@UserName', which was not supplied.
Source Error:
Line 62: Dset.Clear();
Line 63: adapt = new SqlDataAdapter("GetUserPOSTS", constr);
Line 64: adapt.Fill(Dset, "GetUserPOSTS");
Line 65: adapt.SelectCommand.CommandType = CommandType.StoredProcedure;
Line 66: adapt.SelectCommand.Parameters.AddWithValue("@UserName", username);
code
public DataTable GetProfile(string username)
{
SqlConnection constr = new SqlConnection(ConfigurationManager.ConnectionStrings["CONN"].ConnectionString);
DataSet Dset = new DataSet();
SqlDataAdapter adapt;
Dset.Clear();
adapt = new SqlDataAdapter("GetUserPOSTS", constr);
adapt.Fill(Dset, "GetUserPOSTS");
adapt.SelectCommand.CommandType = CommandType.StoredProcedure;
adapt.SelectCommand.Parameters.AddWithValue("@UserName", username);
adapt.SelectCommand.Parameters.AddWithValue("@Id", Id);
adapt = new SqlDataAdapter("GetADPOST", constr);
adapt.Fill(Dset, "GetADPOST");
adapt.SelectCommand.CommandType = CommandType.StoredProcedure;
// adp.SelectCommand.Parameters.AddWithValue("@Email", username);
adapt.SelectCommand.Parameters.AddWithValue("@UserName", username);
adapt.SelectCommand.Parameters.AddWithValue("@Id", Id);
DataTable table1 = new DataTable();
DataTable table2 = new DataTable();
table1 = Dset.Tables[0];
table2 = Dset.Tables[1];
table2.Merge(table1);
return table2;
}