DAL code:
public static ICollection GetData()
{
DataSet ds = new DataSet();
if (!connected)
Connect();
SqlDataAdapter da = new SqlDataAdapter("", conn);
string sql = "SELECT package_id,package_name FROM tbl_packages";
//string sql = "INSERT INTO DealerLoginDetails(Dealer_no,Zipcode,dealerlevel)values FROM ";
da.SelectCommand = new SqlCommand(sql, conn);
da.Fill(ds, "tbl_packages");
return ds.Tables["tbl_packages"].Rows;
}
BAL code:
public static ICollection GetData()
{
return Dataaccessayer.newestimationDAL.GetData();
}
code behind file:
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;
using businesslayer;
using Dataaccessayer;
public partial class new_estimation_step1 : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection("Data Source=RHYTHA-DELL6\\SQLEXPRESS;User Id=sa;Password=rhytha268;Initial Catalog=Profussion");
protected void Page_Load(object sender, EventArgs e)
{
errormess.Visible=false;
ICollection coll = newestimationBAL.GetData();
//DataSet ds = new DataSet();
if(coll.Count>0)
{
BL_packages.DataSource = coll;
string res = coll.ToString();
Label1.Text = res;
BL_packages.DataBind();
}
else
{
errormess.Visible = true;
}
}
}
thanks for replies....
Dhivakar.M
Dhivakar, if this helps please login to Mark As Answer. | Alert Moderator