简体   繁体   中英

Android SQL INSERT Date into Access

I have an Android application that sends data to an ASP page, which then sends the information to an Access database. This worked fully before. Recently we had an issue with our server and now that it has been reset the date field does not submit properly. I have very limited experience and am wondering if this is an issue with my SQL syntax. I will post all relevant code just in case it is something else as well.

Quick breakdown of how my app works. Android code takes date, submits it to an ASP page through the GET method. ASP page uses an SQL statement to insert into an Access database.

Android code (GET Statement):

String vars = "&ReportDate=" + String.valueOf(c.get(Calendar.MONTH) + 1) + "/"
                    + String.valueOf(c.get(Calendar.DAY_OF_MONTH)) + "/" + String.valueOf(c.get(Calendar.YEAR))

ASP code (SQL Statement):

mySQLR=mySQLR & vReportDate & ", "

Is my SQL syntax incorrect for submission into an Access database?

EDIT

My Issue is the date field is not being written to the database when every other field is. The date field has now been left bank in every field.

The variable "ReportDate" is the first field being appended to the url for submission through the GET method and the "&" is unnecessary and causing that particular field to not be submitted.

Editted code:

String vars = "ReportDate=" + String.valueOf(c.get(Calendar.MONTH) + 1) + "/"
                + String.valueOf(c.get(Calendar.DAY_OF_MONTH)) + "/" + String.valueOf

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM