Hi All,
I am trying to use DBUtils.ExecuteHTML
I have a couple of tables with data in them. No problems with getting data in. I am now trying a simple table display using a webview just to get the hang of things.
I start the Result activity using this in a button click;
I then try to set up the table view within the SetUpForm sub
I have pointed to the database in my Main activity. It is in the right place on my tablet and there is no problem interacting with the database in the Main activity or in another activity (Measures) where my data entry is done.
The problem I have seems to be in what I am passing to the DBUtils.ExecuteHTML sub. Program execution stops on line 317, which is when it tries to pass my query off to the SQL library.
The problem is it fails silently. No error is logged. So I put in the Try... Catch and transaction statements above. Just so it failed a bit more elegantly.
I've checked in the debugger and the correct database is being pointed to, the SELECT statement is the one I've entered. So, I am missing something obvious and quite basic- it's just beyond me to know how to look for it.
Any ideas?
cheers
Alistair, Brisbane
I am trying to use DBUtils.ExecuteHTML
I have a couple of tables with data in them. No problems with getting data in. I am now trying a simple table display using a webview just to get the hang of things.
I start the Result activity using this in a button click;
B4X:
Sub btnResult_Click
'show the choice buttons
'btnSurvey.Visible=True
'btnResults.visible=True
Dim chosenAction As Int
Dim ChoiceList As id
userChoice.Initialize
userChoice.AddAll(Array As String("ORS","SRS"))
chosenAction = ChoiceList.InputList1(userChoice,"Results Choice")
'start the activity which displays the results
'use the chosen action to direct the setup details
CallSubDelayed2(Results,"SetUpFormDetails", chosenAction)
End Sub
I then try to set up the table view within the SetUpForm sub
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("lytResults")
End Sub
Sub SetUpFormDetails(listChoice As Int)
Dim selectDataString As String
wbvDataTable.Visible = True
Select listChoice
Case 0
Activity.Title= "ORS Table- " & Main.CurrentClientName
'set up data from ORS
selectDataString = "SELECT date as Date, orsIndiv , orsIntPer, orsSocial, orsSumm,orsAve FROM tbORS WHERE ClientID=" _
& Main.CurrentClientID & " ORDER BY date"
Main.SQL.BeginTransaction
Try
wbvDataTable.LoadHtml(DBUtils.ExecuteHtml(Main.SQL, selectDataString, Null, 0, False))
Main.SQL.TransactionSuccessful
Catch
ToastMessageShow("The database transaction failed", True)
End Try
Main.SQL.EndTransaction
Case 1
Activity.Title="SRS Table- " & Main.CurrentClientName
'set up data from SRS
selectDataString = "SELECT date as Date, srsRelate , srsGoal, srsMeth, srsOverall , srsAve FROM tbSRS WHERE ClientID=" _
& Main.CurrentClientID & " ORDER BY date"
Main.SQL.BeginTransaction
Try
wbvDataTable.LoadHtml(DBUtils.ExecuteHtml(Main.SQL, selectDataString, Null, 0, False))
Main.SQL.TransactionSuccessful
Catch
ToastMessageShow("The database transaction failed", True)
End Try
Main.SQL.EndTransaction
End Select
End Sub
I have pointed to the database in my Main activity. It is in the right place on my tablet and there is no problem interacting with the database in the Main activity or in another activity (Measures) where my data entry is done.
The problem I have seems to be in what I am passing to the DBUtils.ExecuteHTML sub. Program execution stops on line 317, which is when it tries to pass my query off to the SQL library.
B4X:
cur = SQL.ExecQuery(Query)
The problem is it fails silently. No error is logged. So I put in the Try... Catch and transaction statements above. Just so it failed a bit more elegantly.
I've checked in the debugger and the correct database is being pointed to, the SELECT statement is the one I've entered. So, I am missing something obvious and quite basic- it's just beyond me to know how to look for it.
Any ideas?
cheers
Alistair, Brisbane