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 between1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value) at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value) at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value) at System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb) at System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc)
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