[Gambas-user] Database example query

Gianluigi bagonergi at gmail.com
Sat Sep 29 11:43:47 CEST 2018


Your mail ended up in gmail spam (when the programs are too smart they end
up being stupid).
I'll enclose what I promised.

Regards
Gianluigi

Il giorno ven 28 set 2018 alle ore 15:14 Frank H Aldridge <franka at iway.na>
ha scritto:

> I am an absolutely new user of Gambas, 76 years old and only using it to
> write simple self-use programs. I bought the e-book Beginners Guide to
> Gambas, Revised edition from Amazon and as a consequence it does not have
> the cd that would have been included with the hard copy.
>
> I am using Ubuntu 18.4 and Gambas 3.11.90 together with SQLite.
>
> Because I don't have the cd I decided to "create" the Database1 program
> described in the book under "The Database Example Program". I have created
> the main form as well as the FRequest form, both with their various
> controls.
>
> On FMain (I noticed that you cannot change the name of the Main form) I
> placed a Textbox at the bottom in a Frame called SQL request.
>
> During the instructions detailing how the program "works" there is the
> following quote:
>
> "we set the enabled properties for both program forms to TRUE and place
> some default text in the SQL request box at the bottom of the FMain form:
>
> frmDatabase.Enabled = TRUE
> frmRequest.Enabled = TRUE
> txtRequest.Text ="Show Tables"
>
> 1. At this point my problem is that there are no forms called
>  frmDatabase or frmRequest.
>
> 2. My next problem is that the Textbox does not accept multi-lines.
>
> The code for the "RUN Button" (next to the SQL Request text box is:
>
> Public Sub btnRun_Click()
>
>     Dim rData As Result
>
>     Dim hForm As FRequest
>
>     rData = $hConn.Exec(txtRequest.Text)
>     hForm = New FRequest($hConn, rData)
>     hForm.Show
>
>     Catch
>       Message.Error(Error.text)
>
>       End
>
> 3. When I click on the "Run" button a message comes up stating: Query
> failed: near "Show Tables"; syntax error. (I have only entered this
> oneline due to 2 above.
>
> If I blank the Textbox for the SQL query and insert a SQL query directly
> into the line:
> rData = $hConn.Exec("Select * from Test") instead of (txtRequest.Text)then
> I get the message:
>
> Cannot exec request
> Unknown symbol 'Width' in Class 'Font'
> OK
>
> Clicking OK brings the message:
> 'Not enough arguments'
>
> I believe that the above two messages come from the following code under
> the FRequest form.
>
> Private Sub ReadData()
>
>
>     Dim hTable As Table
>     Dim hField As ResultField
>     Dim iInd As Integer
>
>     Inc Application.Busy
>
>     tbvData.Rows.count = 0
>     tbvData.Columns.Count = $rData.Fields.Count
>
>     For Each hField In $rData.Fields
>       With hField
>
>         tbvData.Columns[iInd].Text = .Name
>
>         tbvData.Columns[iInd].Width = WidthFromType(tbvData,
> .Type,.Length,.Name)
>
>         End With
>
>         Inc iInd
>
>         Next
>
>         tbvData.Rows.Count = $rData.Count
>
>         Finally
>
>           Dec Application.Busy
>
>           Catch
>             Message.Error("Cannot exec request" & "\n\n" & Error.Text)
>            End
>
> Can anybody who may have this book and the CD perhaps throw some light on
> what may be causing the problems?
>
> --
> Frank H Aldridge
> P.O. Box 3696
> c/o Kiaat & Bottle Tree Streets
> Ext. 15
> Swakopmund
> +264(0)811248922
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180929/19635791/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Database-3.11.90.tar.gz
Type: application/gzip
Size: 15582 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180929/19635791/attachment-0001.gz>


More information about the User mailing list