Click here to Skip to main content
15,890,426 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
aspx page code..>>>>>
XML
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NI_AD_USER_MST_REPORT1.aspx.cs" Inherits="NIPL.NIPL.htmlreport.NI_AD_USER_MST_REPORT11" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title> user master</title>
     <style type="text/css">
.devanagriBi
{
    font-family:Suchi-Dev-0708W;
    font-size: 25pt;
    height:50;
}
</style>

</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    </form>
</body>
</html

>


businesslayer code...>>>>>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
namespace NIPL.AppCode
{
public class cBLayerusermst
{
DBFunctions cdbLayer;
SqlConnection con;

//string NI_AD_QUERY = "";
public cBLayerusermst()
{

cdbLayer=new DBFunctions();

}
//SqlDataAdapter da;
public Boolean NI_AD_USER_MST(int intuserid, out DataSet dsUserMst)
{
con = cdbLayer.GetDatasetConnection();

SqlDataAdapter da = new SqlDataAdapter("[dbo].[USER_MST_SP]", con);
da.SelectCommand.CommandType = CommandType.StoredProcedure;

da.SelectCommand.Parameters.AddWithValue("@NI_ADUM_USER_ID", intuserid).Value=2;


DataSet dsout = new DataSet();

da.SelectCommand.CommandTimeout = 3600;
da.Fill(dsout, "[dbo].[USER_MST_SP]");
dsUserMst = dsout;
con = cdbLayer.CloseConnection();
return true;
}
}
}




STORE PROCEDURE CODE...>>>>>




USE EMPLOYEE1
GO
ALTER PROCEDURE dbo.USER_MST_SP(



@NI_ADUM_USER_ID INT)

AS
BEGIN

SELECT *FROM nipl.NI_AD_USER_MST WHERE NI_ADUM_USER_ID=@NI_ADUM_USER_ID




END




ASPX.CS PAGE CODE.....>>>>>
XML
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Net;
using NIPL.AppCode;
using System.Data.OleDb;
using System.Text;
namespace NIPL.NIPL.htmlreport
{




    public partial class NI_AD_USER_MST_REPORT11 : System.Web.UI.Page
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["EMPLOYEE1ConnectionString"].ToString());





       // public string NI_AD_USER_MST = "";

        protected void Page_Load(object sender, EventArgs e)
        {


            if (!IsPostBack)
            {
                try
                {
                    con.Open();
                    int intuserid = 2;
                    //string NI_AD_QUERY = "";
                    cBLayerusermst UM = new cBLayerusermst();




                    // HEADER
                    //string NI_ADUM_ENTITY_ID = Request.QueryString["Entity Id"];
                    //string NI_ADUM_USER_ID = Request.QueryString["User Id"];
                    ////string NI_Entity_ID = Session[NI_SessionClass.NI_SS_ENTITYID].ToString();
                    //string NI_ADUM_USER_NAME = Request.QueryString["User Name"];
                    //string NI_ADUM_USER_EMAIL = Request.QueryString["Email Id"];
                    //string NI_ADUM_USER_PAN = Request.QueryString["Pan"];
                    //string NI_ADUM_USER_DEPT_NAME = Request.QueryString["Dept. Name"];
                    //string NI_ADUM_REGISTER_DATE = Request.QueryString["Register Date"];

                    SqlCommand cmd;
                    //SqlDataReader ad;
                    //Response.Write("/br");
                    //Response.Write("</br>");
                    //Response.Write("</br>");
                    //Response.Write("</br>");
                    //Response.Write("</br>");
                    //Response.Write("</br>");
                    Response.Write("<TABLE border=1 cellspacing='0' cellpadding='0' width='100%'> ");
                    Response.Write("<tr>");
                    Response.Write("<th class=\"title1\" width=\"12%\" align='center'>Entity Id</th>");
                    Response.Write("<th class=\"title1\" width=\"12%\" align='center'>User Id</th>");
                    Response.Write("<th class=\"title1\" width=\"15%\" align='center'>USER NAME</th>");
                    Response.Write("<th class=\"title1\" width=\"17%\" align='center'>USER EMAIL ID</th>");
                    Response.Write("<th class=\"title1\" width=\"15%\" align='center'>USER PAN NO.</th>");

                    Response.Write("<th class=\"title1\" width=\"15%\" align='right'>USER DEPT. NAME</th>");
                    Response.Write("<th class=\"title1\" width=\"20%\" align='center'>REGISTER DATE</th>");
                    Response.Write("</tr>");



                    //NI_AD_QUERY = "SELECT NI_ADUM_ENTITY_ID,NI_ADUM_USER_ID,NI_ADUM_USER_NAME,NI_ADUM_USER_EMAIL,NI_ADUM_USER_PAN,NI_ADUM_USER_DEPT_NAME, NI_ADUM_USER_REGISTER_DATE FROM nipl.NI_AD_USER_MST ";



                    // NI_AD_QUERY = "[dbo].[USER_MST_SP] ";

                    //cmd = new SqlCommand(NI_AD_QUERY, con);
                    DataSet ds = new DataSet();

                    UM.NI_AD_USER_MST(intuserid, out ds);


                      //ad = cmd.ExecuteReader();

                    int i = 0;
                   while (i < ds.Tables[0].Rows.Count)
                    {
                        Response.Write("<tr>");
                        Response.Write("<td width=\"15%\" align='left'>" + ds.Tables[0].Rows[i][0].ToString() + "</td>");
                        Response.Write("<td width=\"10%\" align='left'>" + ds.Tables[0].Rows[i][1].ToString() + "</td>");
                        Response.Write("<td width=\"10%\" align='left'>" + ds.Tables[0].Rows[i][2].ToString() + "</td>");
                        Response.Write("<td width=\"10%\" align='left'>" + ds.Tables[0].Rows[i][3].ToString() + "</td>");
                        Response.Write("<td width=\"10%\" align='left'>" + ds.Tables[0].Rows[i][4].ToString() + "</td>");
                        Response.Write("<td width=\"10%\" align='left'>" + ds.Tables[0].Rows[i][5].ToString() + "</td>");
                        Response.Write("</tr>");
                        //intuserid = intuserid + int.Parse(ds.Tables[0].Rows[i][0].ToString());

                        //i++;

                    }

                   Response.Write("</Table>");
                  // Response.Write("</tr>");


                   //Response.Write("/Table");
                    //while (ad.Read())
                    //{
                    //    Response.Write("<tr>");

                    //    Response.Write("<td width=\"12%\" align=\"left\" >  " + ad.GetValue(0).ToString() + "</td>");

                    //    Response.Write("<td width=\"12%\" align=\"left\" >  " + ad.GetValue(1).ToString() + "</td>");
                    //    //Response.Write("<td width=\"25%\" align=\"left\" > </td>");
                    //    //Response.Write("</tr>");

                    //    //Response.Write("<tr>");

                    //    Response.Write("<td width=\"15%\" align=\"left\" >  " + ad.GetValue(2).ToString() + "</td>");

                    //    Response.Write("<td width=\"17%\" align=\"left\" >  " + ad.GetValue(3).ToString() + "</td>");
                    //    //Response.Write("<td width=\"25%\" align=\"left\" > </td>");
                    //    //Response.Write("</tr>");

                    //    //Response.Write("<tr>");

                    //    //Response.Write("<strong><font face='Suchi-Dev-0708W' size='4'>");
                    //    ////Response.Write("®â³âå®âû - 5/Form - 5");

                    //    //Response.Write("<td width=\"25%\" align=\"left\" colspan='2' ><strong><font face='Suchi-Dev-0708W' size='4'> " + ad.GetValue(2).ToString() + "</td>");
                    //    //Response.Write("</font></strong>");
                    //    //Response.Write("</tr>");

                    //    //Response.Write("<tr>");

                    //    Response.Write("<td width=\"15%\" align=\"left\" >  " + ad.GetValue(4).ToString() + "</td>");
                    //    //Response.Write("</tr>");

                    //    //Response.Write("<tr>");

                    //    Response.Write("<td width=\"15%\" align=\"left\" >  " + ad.GetValue(5).ToString() + "</td>");
                    //    //Response.Write("</tr>");

                    //    //Response.Write("<tr>");

                    //    Response.Write("<td width=\"20%\" align=\"left\" >   " + ad.GetValue(6).ToString() + "</td>");
                    //    Response.Write("</tr>");

                    //}
                    //ad.Close();


                }



                catch (Exception eNI)
                {
                    Response.Write(eNI.Message);
                }
                finally
                {
                    con.Close();
                }



            }
        }



    }

}



I m not getting the output in html of selected userid .
Posted
Updated 12-Oct-13 2:45am
v2
Comments
rajshekhar yadav 12-Oct-13 8:46am    
please help me to find out the selected userid ...which is execute in the store procedure
JoCodes 13-Oct-13 5:17am    
What you are getting now as an output??? Have you checked the Store procedure returning rows???
rajshekhar yadav 14-Oct-13 1:10am    
yes store procedure is retruning the row
rajshekhar yadav 14-Oct-13 1:12am    
I m getting the error "Object reference not set to an instance of an object. "
JoCodes 14-Oct-13 1:36am    
Now can you tell me in which line exactly you are getting the null reference exception in the above code posted?

1 solution

STORE PROCEDURE CODE...>>>>>
USE EMPLOYEE1
GO
ALTER PROCEDURE dbo.USER_MST_SP(



@NI_ADUM_USER_ID INT)

AS
BEGIN

SELECT *FROM nipl.NI_AD_USER_MST WHERE NI_ADUM_USER_ID=@NI_ADUM_USER_ID




END


BLAYER CODE..>>>>

Quote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
//namespace NIPL.AppCode

public class cBLayerusermst
{
DBFunctions BLAYER1;
SqlConnection con;


//string NI_AD_QUERY = "";
public cBLayerusermst()
{

BLAYER1 = new DBFunctions();

}
//SqlDataAdapter da;
public bool NI_AD_GET_HTML_OP(int intUserId, out DataSet ds)
{
try
{

con = BLAYER1.GetConnection();

SqlDataAdapter da = new SqlDataAdapter("[dbo].[USER_MST_SP]", con);
da.SelectCommand.CommandType = CommandType.StoredProcedure;

da.SelectCommand.Parameters.AddWithValue("@NI_ADUM_USER_ID", intUserId);
DataSet ds1 = new DataSet();
da.Fill(ds1, "[dbo].[USER_MST_SP]");
ds = ds1;
return true;

}
catch (Exception ex)
{
throw ex;

}

finally
{
con = BLAYER1.CloseConnection();
}


}

//public bool NI_AD_USER_MST(int intuserid,out DataSet dsUserMst)

// {

// try

// {
// // con.Open();
// BLAYER1.GetConnection();
// bool blnCheck;
// SqlDataAdapter da = new SqlDataAdapter("[dbo].[USER_MST_SP]", con);
// da.SelectCommand.CommandType = CommandType.StoredProcedure;
// da.SelectCommand.Parameters.AddWithValue("@NI_ADUM_USER_ID", intuserid);

// // da.SelectCommand.CommandTimeout = 3600;
// DataSet dsout = new DataSet();

// da.Fill(dsout, "[dbo].[USER_MST_SP]");
// dsUserMst = dsout;
// if (dsout.Tables[0].Rows.Count > 0)
// {

// blnCheck = true;
// }
// else
// {
// blnCheck = false;
// }


// return blnCheck;
// }
// catch (Exception ex)
// {
// throw ex;
// }
// finally
// {
// con.Close();
// }
}





ASPX.CS CODE ....>>>>>>>



Quote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Net;
using NIPL.AppCode;
using System.Data.OleDb;
using System.Text;
namespace NIPL.NIPL.htmlreport
{




public partial class NI_AD_USER_MST_REPORT11 : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["EMPLOYEE1ConnectionString"].ToString());

cBLayerusermst UM = new cBLayerusermst();

int intuserid = 2;

// public string NI_AD_USER_MST = "";

protected void Page_Load(object sender, EventArgs e)
{


if (!IsPostBack)
{
try
{
con.Open();

//string NI_AD_QUERY = "";




// HEADER
//string NI_ADUM_ENTITY_ID = Request.QueryString["Entity Id"];
//string NI_ADUM_USER_ID = Request.QueryString["User Id"];
////string NI_Entity_ID = Session[NI_SessionClass.NI_SS_ENTITYID].ToString();
//string NI_ADUM_USER_NAME = Request.QueryString["User Name"];
//string NI_ADUM_USER_EMAIL = Request.QueryString["Email Id"];
//string NI_ADUM_USER_PAN = Request.QueryString["Pan"];
//string NI_ADUM_USER_DEPT_NAME = Request.QueryString["Dept. Name"];
//string NI_ADUM_REGISTER_DATE = Request.QueryString["Register Date"];

// SqlCommand cmd;
//SqlDataReader ad;
//Response.Write("/br");
//Response.Write("");
//Response.Write("");
//Response.Write("");
//Response.Write("");
//Response.Write("");
Response.Write(" ");
Response.Write("");
Response.Write("");
Response.Write("");
Response.Write("");
Response.Write("");
Response.Write("");

Response.Write("");
Response.Write("");
Response.Write("");



//NI_AD_QUERY = "SELECT NI_ADUM_ENTITY_ID,NI_ADUM_USER_ID,NI_ADUM_USER_NAME,NI_ADUM_USER_EMAIL,NI_ADUM_USER_PAN,NI_ADUM_USER_DEPT_NAME, NI_ADUM_USER_REGISTER_DATE FROM nipl.NI_AD_USER_MST ";



// NI_AD_QUERY = "[dbo].[USER_MST_SP] ";

//cmd = new SqlCommand(NI_AD_QUERY, con);


// SqlDataAdapter da = new SqlDataAdapter("[dbo].[USER_MST_SP]", con);
DataSet ds = new DataSet();

UM.NI_AD_GET_HTML_OP(2, out ds);

// da.Fill(ds);

//ad = cmd.ExecuteReader();

int i = 0;
for (i = 0; i < ds.Tables[0].Rows.Count;i++ )
{
Response.Write("");
Response.Write("");
Response.Write("");
Response.Write("");
Response.Write("");
Response.Write("");
Response.Write("");
Response.Write("");
Response.Write("");
//intuserid = intuserid + int.Parse(ds.Tables[0].Rows[i][0].ToString());

//i++;

}

Response.Write("");
Response.Write("
Entity IdUser IdUSER NAMEUSER EMAIL IDUSER PAN NO.USER DEPT. NAMEREGISTER DATE
" + ds.Tables[0].Rows[i][0].ToString() + "" + ds.Tables[0].Rows[i][1].ToString() + "" + ds.Tables[0].Rows[i][2].ToString() + "" + ds.Tables[0].Rows[i][3].ToString() + "" + ds.Tables[0].Rows[i][4].ToString() + "" + ds.Tables[0].Rows[i][5].ToString() + "" + ds.Tables[0].Rows[i][6].ToString() + "
");
// Response.Write("");


//Response.Write("/Table");
//while (ad.Read())
//{
// Response.Write("");

// Response.Write(" " + ad.GetValue(0).ToString() + "");

// Response.Write(" " + ad.GetValue(1).ToString() + "");
// //Response.Write(" ");
// //Response.Write("");

// //Response.Write("");

// Response.Write(" " + ad.GetValue(2).ToString() + "");

// Response.Write(" " + ad.GetValue(3).ToString() + "");
// //Response.Write(" ");
// //Response.Write("");

// //Response.Write("");

// //Response.Write("");
// ////Response.Write("®â³âå®âû - 5/Form - 5");

// //Response.Write(" " + ad.GetValue(2).ToString() + "");
// //Response.Write("
");
// //Response.Write("");

// //Response.Write("");

// Response.Write(" " + ad.GetValue(4).ToString() + "");
// //Response.Write("");

// //Response.Write("");

// Response.Write(" " + ad.GetValue(5).ToString() + "");
// //Response.Write("");

// //Response.Write("");

// Response.Write(" " + ad.GetValue(6).ToString() + "");
// Response.Write("");

//}
//ad.Close();


}



catch (Exception eNI)
{
Response.Write(eNI.Message);
}
finally
{
con.Close();
}



}
}



}

}
 
Share this answer
 
Comments
rajshekhar yadav 14-Oct-13 7:24am    
i got the right out put .....this code is search the userid and show the html page for this userid related data

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900