Column, parameter, or variable #6: Cannot find data type datetime2 in ASP.net core API project

100 Views Asked by At

enter image description here

When i run update-database in nuget console then datetime2 error comes, but when migration file has DateTime type for Doj field. Please provide solution.

I deleted the migration file and then regenerate it by commend add-migration init and then update-database but not working and same error comes. Result : Database created but tables not, means connection string is working.

1

There are 1 best solutions below

0
On

finally problem solved,

Actually my sql server is old version and cannot have datetime2 type of datatype then i have to change type of insert data DOJ changes in migration file

then again i ran command

update-database

and table created successfully.