General information
Title:
Returning a dataset to code-behind
I am running through a chunk of code within a class and I want to return the value of the variable, l_cdesc, to my code-behind. I can only return a DataSet from a class to code-behind via OLEdb, however, the string, l_cdesc, is all I want to return. I can see the correct string value I want when I look at l_cdesc in debugger, but how can I return it to my code-behind? Here is my code....I know I can't return (l_cdesc) as it's written now.
All the DataTables are created before this and they do contain the correct data.....
string l_cdesc = "";;
// Fund
if (dt1.Rows.Count > 0)
{
l_cdesc = dt1.Rows[0]["de_desc"].ToString();
}
// Function
if (dt2.Rows.Count > 0)
{
l_cdesc = l_cdesc + " " + dt2.Rows[0]["de_desc"].ToString();
}
// Object
if (dt3.Rows.Count > 0)
{
l_cdesc = l_cdesc + " " + dt3.Rows[0]["de_desc"].ToString();
}
// Fundsrc
if (dt4.Rows.Count > 0)
{
l_cdesc = l_cdesc + " " + dt4.Rows[0]["de_desc"].ToString();
}
// Instructional Org
if (dt5.Rows.Count > 0)
{
l_cdesc = l_cdesc + " " + dt5.Rows[0]["de_desc"].ToString();
}
// Operational Unit
if (dt6.Rows.Count > 0)
{
l_cdesc = l_cdesc + " " + dt6.Rows[0]["de_desc"].ToString();
}
// Subject Matter
if (dt7.Rows.Count > 0)
{
l_cdesc = l_cdesc + " " + dt7.Rows[0]["de_desc"].ToString();
}
// Job Class
if (dt8.Rows.Count > 0)
{
l_cdesc = l_cdesc + " " + dt8.Rows[0]["de_desc"].ToString();
}
// Special Cost Center
if (dt9.Rows.Count > 0)
{
l_cdesc = l_cdesc + " " + dt9.Rows[0]["de_desc"].ToString();
}
return this.GetDataSet( l_cdesc);
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only