0% found this document useful (0 votes)
148 views

Ex - No: Gambas Date

The document outlines steps to establish database connectivity in GAMBAS and access a database by inserting records. It involves creating a new graphical project in GAMBAS, adding necessary database components, creating a model to define the MySQL connection, and writing code to display data in a grid view, insert new records, and close the connection. The steps establish a connection to a MySQL database, select and display records, insert a new record on button click, and close the form when finished.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views

Ex - No: Gambas Date

The document outlines steps to establish database connectivity in GAMBAS and access a database by inserting records. It involves creating a new graphical project in GAMBAS, adding necessary database components, creating a model to define the MySQL connection, and writing code to display data in a grid view, insert new records, and close the connection. The steps establish a connection to a MySQL database, select and display records, insert a new record on button click, and close the form when finished.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

EX.

NO: DATE : AIM:

GAMBAS

To work with the components in GAMBAS in order to establish the database connectivity and access the database by inserting records. STEPS INVOLVED: STEP:1 - Open Gambas and click New ro!ect STEP:2 - Select Graphical ro!ect

STEP:3 -Give the name and title o" the ro!ect and select the location to save the pro!ect.

STEP:4 -#rom the Tree view in the ro!ect $%plorer & yo' will see the items listed as "ollows( )lasses #orms Mod'les *ata

STEP:5 -)reate a "orm in #Main 'sing the Tool bo% .

To Create a new M S!L Conne"t#on: STEP:1 - Be"ore yo' contin'e& make s're the "ollowing components are selected on yo'r pro!ect( gb.db *atabase Access gb.db.mys+l MyS,- *atabase driver gb.db.odbc O*B) *atabase driver STEP:2 - To enable the components& go to ro!ect . roperties and click )omponent tab STEP:3 - check the "ollowing components /. gb - 0nternal native classes 1. gb.db - *atabase access 2.gb.db."orm - *ata bo'nd )ontrols 3. gb.db.mys+l - MyS,- *atabase *river 4. gb.db.odbc - O*B) database driver STEP:4 $ Now )reate a new mod'le. 5ight click on #orm and select New Mod'le. Give a name to yo'r new mod'le( 6 name is cse in this pro!ect 7 STEP:5 - 8ere is the content o" the mod'le 6 cse.mod'le 7( 9B-0) con AS N$: )onnection 9B-0) 5O)$*95$ )onnect67 con.)lose67 con.Type ; <MyS,-= con.8ost ; <localhost= con.-ogin ; <root= con. assword ; <oslabic= con.Name ; <gambas= con. ort ; <22>?= con.Open67

$N*

STEP:% - Then yo' can call the mod'le on yo'r "orm or program to start or open the MyS,- )onnection 'sing the code below& 9B-0) S9B btnopencon@)lick67 mys+lcon.)onnect67 Message.0n"o6<)onnection opened=7 $N* Ao' can r'n the program to start or open the MyS,- connection by clicking on /7 5OB$)T -C compile 17 *$G9G-C r'n

Co&e 'or t(e 'or) #n *Ma#n."+a,, are : #O5 D0$: B9TTON( 9B-0) S9B B'tton/@)lick67 *0M rs AS 5es'lt *0M rowno AS 0nteger ; > *0M + AS String + ; Eselect F "rom st'dentE rs ; cse.con/.$G$)6+7 GridDiew/.8eader ; GridDiew.8oriHontal GridDiew/.Grid ; T59$ GridDiew/.5ows.)o'nt ; /> GridDiew/.)ol'mns.)o'nt ; /> GridDiew/.)ol'mnsI>J.Te%t ; E0*E GridDiew/.)ol'mnsI/J.Te%t ; ENAM$E GridDiew/.)ol'mnsI>J.:idth ; />> GridDiew/.)ol'mnsI/J.:idth ; />> 0# rs.available T8$N rs.movene%t GridDiew/.5ows.)o'nt ; rs.)o'nt #O5 $A)8 rs GridDiew/Irowno& >J.Te%t ; rsKid

GridDiew/Irowno& /J.Te%t ; rsKname 0N) rowno N$GT $-S$ Message.0n"o6Erecord not "o'ndE7 $N*0# cse.con/.)ommit67 $N* #O5 0NS$5T B9TTON ( 9B-0) S9B B'tton1@)lick67 *0M rs AS 5es'lt cse.con/.Begin67 rs ; cse.con/.)reate6Est'dentE7 rsKid ; Dal'eBo%/.Dal'e rsKname ; Te%tBo%/.Te%t rs.9pdate67 cse.con/.)ommit67 Message.0n"o6E5ecord 0nsertedE7 $N* #O5 )-OS$ B9TTON ( 9B-0) S9B B'tton2@)lick67 #Main.)lose67 $N* STEP:- -5'n the pro!ect by "ollowing steps ( /7 5OB$)T -C compile 17 *$G9G-C r'n

O9T 9T opens in new page as shown below(

:hen yo' click on view b'tton yo' will get the database in grid view as shownbelow(

STEP:. -Ao' can insert the data into database by "illing the rno and name and then clicking on 0NS$5T b'tton

STEP:/ -#inish it by clicking on )-OS$ b'tton

0ES1LT( Th's the database connectivity is established s'ccess"'lly to access the records in the database.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy