myCommand1.Parameters.Add("@I_vBACHNUMB", SqlDbType.Char).Value = GLHdr.BACHNUMB;
myCommand1.Parameters.Add("@I_vREFRENCE", SqlDbType.Char).Value = "ExcelImport";
myCommand1.Parameters.Add("@I_vTRXDATE", SqlDbType.DateTime).Value = GLHdr.TRXDATE;
In last line I have value GLHdr.TRXDATE: "15-02-2017".
I am getting format exception.Let me know where I am doing mistake.
GLHdr.TRXDATEis a string, not aDateTime.You need to parse it into a
DateTimebefore passing it through:Note that
DateTime.Parsecan fail, soParseExactorTryParseExactthat also take a format string may be more suitable for you specific circumstances.