[Gambas-user] Retrieve database records

Christian Faure christian.faurebouvard at ...357...
Thu Nov 18 21:38:06 CET 2004


El Jueves, 18 de Noviembre de 2004 12:07, Linux Power escribió:
> Hi all,
>   I have the following question for anyone that has some spare time to have
> a look on this...
>
> Lets assume we have the following table in a database:
> COLOR   <-- Table Name
> Color_id  <-- Key Value
> NAME     <-- Color Name Records
>
> ---- let records be ---
> black
> blue
> red
> yellow
> --------------------------
>
> and assuming that:
> PUBLIC db AS NEW Connection
> PUBLIC rs AS Result
>
> -- somewhere else on the code --
> DIM sQuery AS String
> sQuery = "SELECT NAME FROM COLOR"
> rs = db.Exec(sQuery)

Hi, try code like this:
	while rs.Available
		ComboBox1.Add(rs["NAME"])
		rs.MoveNext()
	wend
        
>
> If the connection to the database was successfull. How do I load the
> records in a combo box (ie. ComboBox1)?
>
> Tnx in advance
>




More information about the User mailing list