We are doing an app which uses jsonservice(webservice/RESTfull webservice) for backend datadase proccess and andriod as front end..
public DataTable retrv(string id)
{
check();
int ID = Convert.ToInt32(id.ToString());
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "select * from RECVSSMS where Refid='" + ID + "'";
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
While using this code using jsonservice from Android Studio we got all the records in exact format except the Date_Time.
we got records like this :
I/System.out: @@@@@@@@@@@@@@@@@@@@@@{"Value":[{"Date_time":"2016-04-22T02:01:15","status":"1","Message":"test messag reply automatic","FromID":"+919566003138","Refid":24}],"Successful":true}
here is the error clearly : Date_time":"2016-04-22T02:01:15"
An alphabet 'T' appears and incorrect date format
This is database fields:
Refid int
FromID varchar(13)
Message varchar(60)
status varchar(5)
Date_Time datetime
It's not an error it's one of the date time formats sql provide please use the below formatting code to get the desired date
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.