Jitendra Sharma

Jitendra Sharma

  • 973
  • 469
  • 27.8k

string was not recognizes for valid date time...

Nov 15 2016 1:05 AM
ALTER procedure [dbo].[selectdate]
@CrtDate nvarchar(50)
as
begin
select top 1 Dates from General_Cash_Flow where CrtDate=@CrtDate order by CONVERT(nvarchar(50),Dates,120) Desc
end
my code
cmd = new SqlCommand("selectdate", cnn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("CrtDate", SqlDbType.VarChar).Value = login.setvalueyear;
dr = cmd.ExecuteReader();
if (dr.Read())
{
string ddt = dr["Dates"].ToString();
dtpckVoucherDate.Text = string.Format("{0:dd/MM/yyyy}", ddt);
}
dr.Close();
i have different-different date max date show in ddt but in datetimepicker not show max date
and give error string was not recognized for valid date time ....

Answers (1)