Hi there,
I have a doubt that, while i am creating crystal reports using c#.net. I have got the error as "Specified cast is not valid".The code is as follows.
str1 = "SELECT sum(dbo.VisitDetails.RegistrationFee) FROM dbo.VisitDetails INNER JOIN dbo.EmployeeMaster ON dbo.VisitDetails.Emp_Id = dbo.EmployeeMaster.Emp_Id where visitid = 1 and EmployeeMaster.Emp_Id = '" + Emp_Id + "' and CAST( CONVERT( varchar(
,Visitdate, 112) AS DATETIME) between isnull ('" + dtpOne.Value.ToString("MM/dd/yyyy") + "',VisitDate) and isnull ('" + dtpTwo.Value.ToString("MM/dd/yyyy") + "',VisitDate)and dbo.VisitDetails.RegistrationFee is not null";
cmd = newSqlCommand(str1, con);
con.Open();
if (!Convert.IsDBNull(Convert.ToDecimal(cmd.ExecuteScalar())))
{
total_NewPatientAmount = Convert.ToDecimal(cmd.ExecuteScalar());
}
so, please help if you know.