I am attempting to query a SQL Server table with RDC.
I get this error:
B4X:
java.sql.SQLException: Conversion failed when converting date and/or time from character string.
Error: Server Error
My Config file on the server is:
B4X:
#SQL Server
DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://197.xxx.xxx.xxx:1440/sectorstores
User=xxxxxx
Password=xxxxxx
ServerPort=17170
#If Debug is true then this file will be reloaded on every query.
#This is useful if you need to modify the queries.
Debug=true
#commands
sql.get_dates=SELECT DISTINCT [Sale Date] FROM SalesEndUser
sql.sales_end_user=SELECT * FROM SalesEndUser WHERE [Sale Date] BETWEEN ? AND ?
Where the first "?" is the StartDate and the second "?" is the EndDate
My Sub that calls this query is:
B4X:
Sub GetSales(Name As String)
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "sales_end_user"
cmd.Parameters = Array As Object(Name,StartDate,EndDate)
Msgbox(StartDate,"StartDate")
Msgbox(EndDate,"EndDate")
Msgbox(cmd,"CMD")
reqManager.ExecuteQuery(cmd, 0, "GetSales")
End Sub
Both variables; StartDate and EndDate are Global variables.
The MsgBox(s) are only for "debug" to make sure I have the correct data from the variables.
#SQL Server
DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://XXX.XXX.X.XX:1433/smart_microfinance
User=*****
Password=******
ServerPort=1433
#If Debug is true then this file will be reloaded on every query.
#This is useful if you need to modify the queries.
Debug=true