2011-01-01 12:17:51.967
to do this I have written:
client Application:
string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff",CultureInfo.InvariantCulture);
PropertyClass prp=new PropertyClass();
Prp.TransDate=date;
webserviceobj.CreateTansaction(Prp);
PropertyClass structure in webservice class:
Public class property
{
private string transdate;
public string TransDate
{
get
{
return transdate;
}
set
{
transdate = value;
}
}
}
In webservice,From DAL layer passing the TransactionDate like this:
Cmd.Parameters.Add("@TranSactionDate", SqlDbType.VarChar, 20).Value = propertyobj.TransDate;
While debugging from client application:
I am getting this exceptions:
System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between
Note: my backend sql datefield wants the date paramter 2011-01-01 12:17:51.967 in this format, so I am passing this date as string.
How can I solve this issue any help pls……. Your help is heartly appreciated.
Thanks,
Rahul
Krishna GaradPosted Jan 1, 2011, 7:54 AM
If your TransactionDate is datetime in backemd then why you are passing it as string from dal. Just Replace this with this line
Cmd.Parameters.Add("@TranSactionDate", SqlDbType.DateTime).Value = propertyobj.TransDate;
And convert your Date string to DateTime
Try this may be help