[Gambas-user] help with datascrol control
tomasz brymora
tomekpilot at ...626...
Sat Jul 28 04:18:07 CEST 2012
Greetings!
I decided to dev a project in Gambas and being a complete noob, got stuck
on using the DataScroll control.
I can connect to PostgreSql and save data.
I'm trying to read it back in and populate DataScroll and that's where I'm
lost.
On the form I got DataSource1 and as it's children DataView1 and
DataScroll1.
So far I tried to read the docs and find a simple tutorial/example that
shows start to finish how the datasource and/or connection work with
DataScroll.
Below are the details of what I got so far ( with partial screenshot of the
form in question )
Thanks in advance.
*FORM CLASS fragment:*
' Gambas class file
Public Sub _new()
End
dbrowserData As Result
Public Sub Form_Open()
pgSqlConnector.openDB
'pouplate data browser
dbrowserData = pgSqlConnector.runSql("select * from airport")
DataBrowser1.Enabled = True
DataBrowser1.Editable = True
DataBrowser1.Grid = dbrowserData
End
*DB CONNECTION CLASS:*
' Gambas class file
Create Static
Private pgSqlConnection As New Connection
Private res As Result
Public Sub openDB()
With pgSqlConnection
.Type = "postgresql"
.Host = "localhost"
.Login = "postgres"
.Password = "solaris"
.Name = "flight_log"
.Open
End With
End
Public Sub runSql(sql As String) As Result
res = pgSqlConnection.Exec(sql)
Return res
End
Public Sub clsoeDB()
pgSqlConnection.Close
End
*TABLE IN POSTGRES:*
CREATE TABLE airport
(
id bigint NOT NULL,
icao_identifier character varying(255),
version bigint NOT NULL,
CONSTRAINT airport_pkey PRIMARY KEY (id )
)
[image: Inline image 1]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 18262 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20120727/03544a2f/attachment.png>
More information about the User
mailing list