[Gambas-user] How to know Connection State?

ron ronstk at ...239...
Thu Apr 22 12:05:34 CEST 2004


On Thursday 22 April 2004 09:54, Teguh Nuryadi wrote:
> Dear,
>
> I am Teguh Nuryadi from Kebumen, Jawa Tengah (Central Java) - Indonesia but
> now on Jakarta.  I am proffesional in Microsoft Visual Basic, but in Gambas
> i am beginner.
>
> Now i convert my project to Manage SMS from mobile phone from Visual Basic
> Language to Gambas
>
> I have a problem to handle connection state.
> if in Visual Basic handle with
>     dim cn as new ADODB.Connection

	DIM cn AS Connection
>

	cn.type="mysql"
	cn.host="localhost"
	cn.password="thepassword"
	cn.login="thelogin"
	cn.name="thedatabasename"
	cn.open()

>     cn.open 'connection string'
>   cn.state   --> if 1 is open and 0 is close

	this does not exist, 
	you are not able to see the open/close/error 
	condition of the connection in a clear way.

>
> Second, how to close our Result
> if in Visual Basic
>     dim rs as new ADODB.Recordset

	dim rs as Result
>
>     rs.open 'sql statement', connection

	rs = cn.exec(sql statement)

>     rs.close    ---> to close opened recordset

	this does not exist, 
	you are not able to see the open/close/error 
	condition of the recordset in a clear way.

	rs.commit ' after write to it
	rs=null 'free memory if for read used
	rs =cn.exec(sql statement other) 'reuse it

>
> but in Gambas i'm not meet it.
>

In my view the ADODB is in no way compatible with gambas.
The whole structure of it is to different for gambas, you can not
use the old VB code. Same for RDO an Jet Databases.

The best way to learn is to look in the code of the database manager.
This is the best example that shows it can be done and works.
It is indeed missing the status of the connection and a error property
telling what is wrong with it.
To say it simple, forget the ADODB way forever in gambas, you will be 
disappointed if you think that way.

Ron.

> Please kindly help me to solving problem
>
> Thank you
>
>
> Teguh Nuryadi




More information about the User mailing list