cannot convert value of parameter date from system string to system datetime

后端 未结 5 1189
终归单人心
终归单人心 2020-12-22 15:31
public Kupac(SqlDataReader reader)
{
    KupacId = Convert.ToInt32(reader[\"KupacId\"]);
    Ime = reader[\"Ime\"].ToString();
    Prezime = reader[\"Prezime\"].ToSt         


        
5条回答
  •  不思量自难忘°
    2020-12-22 16:22

    You can't cast a string into a date time but you can use DateTime's Parse:

    ClanOd = DateTime.Parse(reader["ClanOd"]);
    

提交回复
热议问题