I am attempting to cast a string gotten from a local database into decimal, but resulted in a "Cannot implicitly convert Type 'GlobalCurrencyConverter.CurrencyRateDataSet.rateDataTable' to decimal".
Below is my code,
protected decimal calRate_Click(object sender, EventArgs e)
{
CurrencyRateDataSetTableAdapters.rateTableAdapter rateTable;
decimal exRate = (decimal)rateTable.GetDataBySourceTargetCurrency(objDropDownSourceCUR.SelectedValue, objDropDownTargetCUR.SelectedValue);
decimal exAmt = 0;
exAmt = (decimal)Convert.ToDecimal(objTextBoxSourceAmt.Text);
}
Update:
rateTable.getDataBySourceTargetCurrency is a method created in Visual Studio Designer. It takes in 2 parameters and search through the local database, returning a single row (and single column) of value.