Connecting to Remote MS SQL DB

Always Learning

New Member
Licensed User
Longtime User
Hi There,

I am trying to connect to a remote MS DB but nothing shows on the emulator.
I have followed the tutorial and when I type in internet explorer:
http://www.dotnet4site.com/mattrack/MyTestPage.aspx?query=Select Description,DateRaised from tbmattrack
I get data back.

But when I try from the android program nothing comes back.

This is my code:
'Activity module
Sub Process_Globals
Dim ServerUrl As String
ServerUrl = "http://www.dotnet4site.com/mattrack/MyTestPage.aspx"
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
HttpUtils.CallbackActivity = "Main"
HttpUtils.CallbackJobDoneSub = "JobDone"
End If

HttpUtils.PostString("Job1", ServerUrl, "SELECT Description, DateRaised FROM tbMatTrack")
End Sub

Sub Activity_Resume
If HttpUtils.Complete = True Then JobDone(HttpUtils.Job)
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub JobDone (Job As String)
If HttpUtils.IsSuccess(ServerUrl) Then
Dim parser As JSONParser
Dim response As String
response = HttpUtils.GetString(ServerUrl)
parser.Initialize(response)
Dim rows As List
rows = parser.NextArray

'work with result
'rows is a List. Each item is a Map with the columns names as keys and the db values as the values.
For i = 0 To rows.Size - 1
Log("Rows #" & i)
Dim m As Map
m = rows.Get(i)
Log("Description=" & m.Get("Description")) 'log the values of col1 and col2
Log("DateRaised=" & m.Get("DateRaised"))
Next
End If
HttpUtils.Complete = False
End Sub

Thanks for your help.

Best Regards,

Steve.
 

Always Learning

New Member
Licensed User
Longtime User
Hi There,

Thanks for the reply.
Ok, Code Tags in future. Sorry.

Can you tell me, How do I check the logs?

Thanks for the help,

Best Regards,

Steve.
 
Upvote 0

Always Learning

New Member
Licensed User
Longtime User
Hi There,
Thanks for the reply.

I Think my Emulator cannot connect to the internet.

Are there any good books on connecting to MS Sql Server datatables via Android.

Best Regards,

Steve.
 
Upvote 0

Always Learning

New Member
Licensed User
Longtime User
Hi There,

Good news, I am now able to bring data out of the database.
My log is showing the data records correctly but it is not showing in a list on the emulator.

How do I get this data to show in a list on the emulators screen.

Thanks for your help.

Best Regards,

Steve.
 
Upvote 0
Top