In order to use a parameter within your command you need to include the where clause:
public string Calcu_soud(string stat_pay , string az_ti , string ta_ti)
{
string gt = string.Empty;
string _comm_calcu_soud = " SELECT SUM(kala.soud_mounth) AS Expr1 FROM (kala)";
string _comm_calcu_soud += " WHERE status_pay = ?";
OleDbParameter[] gh = new OleDbParameter[1];
gh[0] = new OleDbParameter("status_pay", OleDbType.Char);
gh[0].Value = Convert.ToString(stat_pay);
gt = a.Query_Select_Executescaler_with_para(_comm_calcu_soud, gh).ToString();
return gt;
}
OleDbParamaters will have to be added in order of the qMarks ('?') as they don't use named parameters. In fact, you can name your parameter foo or bar and it won't effect the command.
Here are a couple of articles that show the parameters being used:
Intermediate OLE DB Consumer with C#[
^]
And the difference between OleDb and Ado style parameters:
Parameters - SqlCommand vs. OledbCommand and OdbcCommand[
^]
Hope that helps ^_^
Don't forget to like and subscribe :Þ