I have this method.
public static long? GetPayments(int PaymentId,string Reference)
{
try
{
using (SqlConnection con = new SqlConnection(connstrig))
{
con.Open();
DynamicParameters param = new DynamicParameters();
param.Add("@IDPayment", PaymentId);
param.Add("@Ref", Reference);
var result = con.Query<long?>("spc_PaymentStatusForCombo", param, commandType: CommandType.StoredProcedure).FirstOrDefault();
return result;
}
}
catch (Exception exc)
{
ApplicationLog.WriteLog("spc_PaymentStatusForCombo", exc.Message, "Error");
return null;
}
}
And when i call it this error is shown up:Input string was not in a correct format.
var result =
GetPaymentsByPayId(Convert.ToInt32(txt_IdPayment.Text.Trim()), (txt_IdPayment.Text.Length > 0) ? (txt_OrderID.Text.Trim()) : string.Empty);
Can you help me please? Thank you
txt_IdPayment.Textis a valid Int32 ?TextChanged Event?txt_IdPayment.Text, try to debug your code and check the value oftxt_IdPayment.Text