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]

<<image.png>>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to