Retrieving values from typed dataset

S

Sue

Hello All

I have a typed dataset called PropertyDS, with 2 colums named -
fld_propertyname and fld_propertyvalue. From my web app, I store
values in these columns with a Add_row function. So, it should hold
values like "txtAdditionalCourseInfo" in the column fld_propertyname
and "Mfg 101" in the column fld_propertyvalue.

Later on, I need to retrieve values by sending the fld_propertyname
(txtAdditionalCourseInfo) and correspondingly get its value "Mfg 101".
How do I do that? I vaguely rememeber about doing it in combination of
key and value, but do not remember the syntax for it. Would appreciate
your help.


//code where the rows are added


public void AddHeaderPropertyRow(string propertyName, string
propertyValue)
{
PropertyDataSet.Tbl_PropertyRow dr =
this.PropertyDS.Tbl_Property.NewTbl_PropertyRow();
dr.fld_PropertyName = propertyName;
dr.fld_PropertyValue = propertyValue;
this.PropertyDS.Tbl_Property.AddTbl_PropertyRow(dr);
}

//Code where the GetPropertyValue function is called

private void LoadPropertyValuesToCourseDS()
{
LyoTrainingCourseDataSet.Tbl_CourseRequestHeaderInfoRow drCourseHeader
=
CourseDS.Tbl_CourseRequestHeaderInfo.NewTbl_CourseRequestHeaderInfoRow();
drCourseHeader.fld_AdditionalCourseInfo =
this.GetPropertyValue("txtAdditionalCourseInfo");
}



//code where I need to retreive the value sending the properyname

public string GetPropertyValue(string propertyName)
{
//this.PropertyDS.Tbl_Property.fld_PropertyNameColumn.
{propertyName}.v.ColumnName
return "the propertyvalue";
}
 
S

sloan

this.PropertyDS.Tbl_Property.Select ( "fld_propertyname= '" + someVariable +
"'";

notice single quotes.

if its an int then

this.PropertyDS.Tbl_Property.Select ( "Age = " + someVariable.ToString()) ;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top