Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
Database - Put database into columnview

PUT SQLITE DATABASE INTO COLUMNVIEW


bddview.png
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
Last update : 26/12/2011 @ 22:35
Category : Database
Page read 4534 times


Print the article Print the article


react.gifReactions to this article


Reaction #2 

by manu 08/01/2012 @ 12:01

Il ne faut pas oublier de créer en entête de la classe, l'objet maconnexion par un petit :
Private maconnexion as New Connection

QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^