not binding data from to data base in asp.net
Hi frnds
i am binding the data from to data base using grid ..here i got a page but without data might be my procedure in correct
please let me know where i did mistake
iam sharing my code
This is my procedure
ALTER PROC [dbo].[Inward_User_Display]
(
@User_Id int =null,
@PageIndex INT = NULL,
@PageSize INT = NULL ,
@RecordCount INT OUTPUT
)
AS
BEGIN
BEGIN TRY
SET NOCOUNT ON;
if(@User_Id !=1)
BEGIN
SELECT User_Id, Name,UserName,Email,Designation,User_Type,Department,Status
FROM tbl_Inward_Mst_User_Diary WHERE
User_Id=@User_Id order by Name desc
END
SET NOCOUNT OFF;
END TRY
BEGIN CATCH
exec sp_error_handler
IF @@TRANCOUNT>0
ROLLBACK
RETURN -101
END CATCH
RETURN 0
END
this is my dal class--
public DataSet UserDisplay(UserDiaryOB objUserDiaryOB)
{
try
{
SqlParameter[] param = new SqlParameter[1];
param[0] = new SqlParameter("@RecordCount", SqlDbType.Int);
param[0].Direction = ParameterDirection.Output;
ncmdbObject.Parameters.Add(param[0]);
ncmdbObject.Parameters.Add(new SqlParameter("@PageIndex", objUserDiaryOB.PageIndex));
ncmdbObject.Parameters.Add(new SqlParameter("@PageSize", objUserDiaryOB.PageSize));
ncmdbObject.Parameters.Add(new SqlParameter("@User_Id", objUserDiaryOB.User_Id));
// ncmdbObject.Parameters.Add(new SqlParameter("@Name", objUserDiaryOB.Name));
p_Val.dSet = ncmdbObject.ExecuteDataSet("Inward_User_Display");
return p_Val.dSet;
}
catch (Exception)
{
throw;
}
}
this is my display function
private void DisplayUser()
{
objUserDiaryOB.PageIndex = 1;
objUserDiaryOB.PageSize = 50;
// objUserDiaryOB.User_Id = null;
p_Var.dSet = objUserDiaryBL.UserDisplay(objUserDiaryOB);
if (p_Var.dSet.Tables[0].Rows.Count > 0)
{
GrdViewUsers.DataSource = p_Var.dSet;
GrdViewUsers.DataBind();
}
}