I have this webservice that connects to my database via a table adapter and I am trying to read the column value based on the controls passed by an AJAX script that I wrote. I tried to use a hash table to replicate the actual database column.
What I like to accomplish is to use to concatinate the hash value into the row property of the table and I can't get to work. Now I don't know if my implementation is feasible, but if anyone knows a way to accomplish what I am trying to do, I would appreciate it.
[WebMethod]
public int GetAlertSetting(string Control, int ContactID)
{
Hashtable ContactHash = new Hashtable();
int AlertsValue = 0;
ContactHash.Add("rdoLB", "LowBattery");
ContactHash.Add("rdoGeo", "Geofence");
ContactHash.Add("rdoAC", "AcDc");
ContactHash.Add("rdoCU", "Capacity");
string HashValue = Convert.ToString(ContactHash[Control]);
AlertsTableAdapter GAlerts = new AlertsTableAdapter();
GeoPlane.AlertsDataTable GAlertsTable = GAlerts.GetAlertsByContactID(ContactID);
GeoPlane.AlertsRow GAlertsRow = GAlertsTable[0];
AlertsValue = GAlertsRow.ContactHash[Control]; //don't know if this is correct.
return (AlertsValue);
//I could also return the value like this
return(GAlertsRow.ContactHash[Control]); //If I can get the above to work.
}