TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Anjali Khan
NA
867
223.7k
not binding data from to data base in asp.net
Dec 7 2017 2:23 AM
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();
}
}
Attachment:
bind.zip
Reply
Answers (
5
)
How to add a custom Font Control
Insert multiple excel data using single submit button