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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Jan 18, 2013, 11:28 PM
<%@ 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
JAYRAMPosted Jan 18, 2013, 10:45 PM
Akkiraju IvaturiPosted Jan 18, 2013, 1:25 PM
By the way you need help in querying correct?