troubleshooting Question

c# datable display data

Avatar of R8VI
R8VI asked on
.NET ProgrammingASP.NETC#
8 Comments1 Solution306 ViewsLast Modified:
HI,

I have the below code I am operating a 3 tier Arch, with presentation, business, and data layer.

I am getting a value Ifrom the DB I need to know how to display the value in the label

Please help

Thanks,

R8VI
Data Layer

 public DataTable LoadPropertyId(string sPropertyNumber, string sStreetName)

        string connStr = ConfigurationManager.ConnectionStrings["SplitfeeConnString"].ToString();
        SqlConnection conn = new SqlConnection(connStr);
        conn.Open();
        SqlCommand cmd = new SqlCommand("spGetPID", conn);
        cmd.CommandType = CommandType.StoredProcedure;


        DataTable DTpropID = new DataTable();

        try
        {

            cmd.Parameters.AddWithValue("@PropertyNumber", sPropertyNumber);
            cmd.Parameters.AddWithValue("@StreetName", 


            // Create new DataAdapter
            using (SqlDataAdapter sqlDataAdptGetPropertyID = new SqlDataAdapter("sp", conn))
            {

                sqlDataAdptGetPropertyID.Fill(DTpropID);


            }
        }
        catch
        {
            throw;
        }

        finally
        {
            cmd.Dispose();
            conn.Close();
            conn.Dispose();
        }

        return DTpropID; 

    }

Business layer

public DataTable LoadPropertyIdBAL(string sPropertyNumber, string sStreetName)
    {

        DataTable DTpropIDBAL = new DataTable();

        GetPropertyInfoDAL DataTablePropertyID = new GetPropertyInfoDAL();

        try
        {
            DataTablePropertyID.LoadPropertyId(sPropertyNumber, sStreetName);
        }
        catch
        {
            throw;
        }


        return DTpropIDBAL;
    }

Presentention layer

string sPropertyNumber = txtPropertyNumber.Text;
            string sStreetName = txtStreet.Text;
         

            GetPropertyInfoBAL PropertyID = new GetPropertyInfoBAL();

            PropertyID.LoadPropertyIdBAL(sPropertyNumber, sStreetName);

//need to display what is in the datatable in this text box             
            lblPropertyID.Text = "";

Open in new window

ASKER CERTIFIED SOLUTION
starlite551

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros