Android Tutorial Accessing remote DBs with B4A using HttpUtils2, Classic ASP, IIS 5.1 and MSAccess

BarrySumpter

Active Member
Licensed User
Note: the attached project contains CLASSIC asp scripts and NOT asp.net scripts.


I have a propriatary PC app that uses MSAccess.
The author is good enough to leave the MSAccess .mdb tables unsecured.
Where he gives free access to the table layout and the data contained there in.
... i.e. the data belongs to his clients.

But there are NO queries or reports etc available.

I've asked multiple times for web access ( and now mobile access )
but it seems its too expensive, too complex, or not requested by enough clients.

So I've decided to do it myself.

My apps are for me, my family and friends, and designed for HTC HD2.
And I have no intention of selling in any way shape or form.

--
I tried to start with a web solution only via phone browsers but found I didn't know enough about web languages to control the width of the screen enough for all android sizes etc.

And I really didn't want to learn yet another language.

----

As far as I know I CAN'T access a remote MSAccess .mdb directly from Android via B4A.
So I have to use a web server.

I already have IIS 5.1 already setup and working.

I use simple DNS plus to redirect m.com to my IIS server (192.168.1.2)
which is just the familys main web page

The m.com is short for mobile.com
I wanted just m but the phones can't handle just m so its m.com.

--

I've found that I get better / faster response from all my computers and phones when they have a static IP Address.

i.e.

Router:
192.168.1.1

MyMainComputer:
192.168.1.2
where simple DNS plus is running
Default Gateway of 192.168.1.1
and DNS1 of 192.168.1.2

Any other computers or phones:
192.168.1.x
Gateway of 192.168.1.1
and DNS1 of 192.168.1.2

--

Attached to this post is a b4a project HttpUtils2WithASP.b4a

The only thing in this b4a project that actually relates to CLASSIC ASP is the
PostString call to an asp script on my IIS 5.1 web server:
B4X:
Jobx.PostString("m.com/b4a/myB4AScript.asp")
--

Also in the Files folder is some very simple asp scripts like HelloWorld to make sure CLASSIC ASP is working.

And a very simple asp script that opens a MSAccess .mdb and validates a UID and PW.

--
This should be an easy enough start to get us into all kinds of trouble.

Can't express enough how easy it was with HTTPUtils2 and examples.


..
 

Attachments

Last edited:

EenOog

New Member
Licensed User
Well Done

Thanx gonna try this shortly have a webservice i need to consume

:sign0142:
 

BarrySumpter

Active Member
Licensed User
Wanted to hide the sql queries.
So created a very simple
GenericASPsql.asp script

Found that asp or iis 5.1 strips spaces out of the query.
So added b4a code to URLEncode the quuery.

If inserting a ms access record I return the RecID of the record that has been added.
I use Select @@Identity within the same connection session to ensure the correct RecID gets returned.



hth

Note so self:
I'd prefer to return just a 0
or a -1 with error comment
 

Attachments

Last edited:

jeronimovilar2

Member
Licensed User
How to get the values

How can i get the results on B4a? Example:

.ASP
"Select C1, C2 from table"

and return to B4a the C1 value...
lbl.Text = table("C1")


sorry my english (from Brazil)
 

BarrySumpter

Active Member
Licensed User
sup jeronimo!

Its all super easy and all the sample apps and scripts are there in the attachment on the first post.
If you don't see the attachment in the first post you'll need to send an email to Erel.
 
Last edited:

jeronimovilar2

Member
Licensed User
Error: org.apache.http.conn.ConnectTimeoutException

I´m using a ASP to connect on the ACCESS DATABASE. Using a browser in my notebook is correct.
Result:
[{"contador":1,"Codigo":19,"Usuario":"Jeronimo Vilar"}]


But it shows this error on the android:

Error: org.apache.http.conn.ConnectTimeoutException: Connect to /189.189.189.189:80 timed out

why?
 

grupotgr

Member
Licensed User
Help

Hello, how are you?
Can you help me? I need to show the database in a list and then display it on screen. Then store in sqlite.

The tests I'm doing with this same example.

Sorry for my bad Englih...

Thank you very much!
Regards,
 
Top