Share your opinion
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
|
Database - Put database into columnview
PUT SQLITE DATABASE INTO COLUMNVIEW
Hye,
Today we put datas from a sqlite database into a simple columnview.
A) create columnview Clicon the columnview widget and draw it into your form. B)Columnview parameters For our example, we define a 4 columns columnview in the Form_open function as this : PUBLIC SUB Form_Open() ColumnView1.Columns.count = 4 ColumnView1.Columns[0].Width = 50 ColumnView1.Columns[0].Text = "ID" ColumnView1.Columns[1].Text = "Familly" ColumnView1.Columns[2].Text = "reference" ColumnView1.Columns[3].Text = "designation" updategrid() 'put data from database to our columnview END C)put data from database to our columnview Here, we suppose our database is existing Ici nous supposons que notre bdd existe. You find bellow the code : PUBLIC SUB updategrid() DIM mykey AS Integer = 0 maconnexion.Type = Lower("sqlite3") 'type of bdd maconnexion.Host = Application.Path 'database path maconnexion.Name = "bdddata" 'database name maconnexion.Login = "" 'login maconnexion.Password = "" ' password maconnexion.Port = "" ' gate maconnexion.Open() 'open the database sql = "SELECT * FROM articles WHERE ID LIKE '%" & "" & "%'" monresultat = maconnexion.Exec(sql) ColumnView1.Clear() 'clear columnview FOR EACH monresultat ColumnView1.Add(thekey, Now) 'Add first line ColumnView1[thekey][0] = monresultat!ID ColumnView1[thekey][1] = monresultat!famille ColumnView1[thekey][2] = monresultat!refinterne ColumnView1[thekey][3] = monresultat!designation INC thekey 'increase the line of columnview NEXT maconnexion.Close() 'close the connexion END Thanks for your attention. Creation date : 26/12/2011 @ 22:35 Reactions to this article
| QUICK MENU
SEARCH
LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS
visitors visitors online ARCHIVES GAMBAS 1/2
|