HI Tim
1) What would be the best way to gather the MS Sql data? I have complete control over the server so can pre-filter the data or can do it while connected.
I use http and asp page to run stored procedures and return data. Here is sample:
qry=request.form'("qry")
sqlConnectStr=session("ConnectionString")
Set SqlConn = Server.CreateObject("ADODB.Connection")
sqlConn.open session("ConnectionString")
set oRs=server.CreateObject("ADODB.RecordSet")
ors.Open qry,sqlConn,3,1
on error resume next
if oRs.BOF and oRs.EOF then
Response.Write("0")
else
Response.Write(oRs.GetString(2)) 'this returns chr(13) separated records and a TAB separated record
end if
This is a sub I use to get a "List" of records
Sub GetRecords(result As String) As List
Dim aList As List
aList.Initialize
'Dim line As String
If EndRecord="" Then
EndRecord=Chr(13)'Chr(0)
End If
If result="0" Then 'nothing
Else
Dim lines() As String
lines=Regex.Split(EndRecord,result)
Dim A As Int
For A=1 To lines.Length
aList.Add(lines(A-1))
Next
End If
Return aList
End Sub
Used like this in a httpjob "done":
If job.Success Then
Dim Records As List
Records=GetRecords(job.GetString)
and I loop through the "records" like this:
For Each ALine As String In Records
Dim line() As String
line=Regex.Split(TAB,ALine)
Edit1.text=line(0)
Edit2.text=line(1)
...etc
2) What is the best storage method on the tablet? SQLITE?
I Use SQL Lite to log everything. My transactions are done in real-time unless there is a network glitch. I have a "posted" flag such that I can return any "SQL Script" that hasn't been posted yet.
Here's a "log" script I use:
Sub LogSQL(SQL As String) As Int
Dim sSql As String
sSql="INSERT INTO SQLLog(Date,SQL,Posted) VALUES(" & Delphi.Date & ",'" & SQL.Replace("'","""") & "',0)" 'the date is only for the "log" to know when it was logged
Log(sSql)
ASQL.ExecNonQuery(sSql)
sSql="Select last_insert_rowid()"
Return ASQL.ExecQuerySingleResult(sSql)
Here's an update script I use:
Dim sSQL As String
sSQL="UPDATE SQLLog SET POSTED=1 WHERE ID=" & ID
ASQL.ExecNonQuery(sSQL)
3) How would I best return the data to the server? I will want to flag transactions as sent so they remain on the tablet but are not sent each time. (That should be easy).
As I said earlier, I use http and Stored Procedures to post data to my server. I do thousands of transactions per day in real-time. You could store your "SQL INSERT Script" in a simple SQLLITE table with the "posted" flag=0. When ready to "post" your transactions you loop through your table that has posted=0 and post to http. I successful you flag it posted=1
4) Should the data transfer functions be in their own app separate from the data entry app?
I would just do it within the app. Maybe run it as a service.
I do hundreds of thousands of transactions this way. Hope this helps you move forward.