plz write the code in businesslayer
read total employes
EMP Table AS Follows;
EMPID EMPNAME MGRNo MGRNAME
1 Raj Null RAvi
2 Ram 1 Sam
3 ttt 2 ghg
4 Hari 3 Yogi
from the above EMP Table i wan the output as follows
total no of employes 4
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Jan 18, 2013, 6:28 PM EST
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Count_total_empid._Default" %>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Count_total_empid
{
public partial class _Default : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
protected void btn_count_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select count(*)from employee";
com = new SqlCommand(str, con);
Label1.Text = "Total no of employees::" + com.ExecuteScalar().ToString();
con.Close();
}
}
}
Thanks
If this post helps you mark it as answer
Akkiraju IvaturiRank #473 · 5.3K reputationPosted Jan 18, 2013, 8:25 AM EST
By the way you need help in querying correct?
JAYRAMRank #7,836 · 233 reputationPosted Jan 18, 2013, 5:45 PM EST