From: BillT on
Hi Geoff,
Yes, I understand from previous writings that you have a severe
allergy to the VO SQL! But I puzzle about the fact that I have used
the VO SQL Servers satisfactorily when I first set up this application
using the standard VO Browser. My problems have only arrived since I
have been trying to convert to using bBrowser, after reading all the
positive reports about the wonders of bBrowser in this Forum. Now I
sometimes wonder if I have made the right move?? But I do like, and am
already using, some of bB's nice features.

But back to SQL, I have had a brief look at ADO and it seems to be
overkill when I am not working in a network environment? My program
runs on a single machine against a small, 4-table database on that
same machine.

Your suggestion about using raw SQL grabs me better at this stage. But
you will see from my reply to Johan that even that has not started
smoothly! How do I go about obtaining Robert's samples and
documentation that you refer to?

Continuing thanks for your help,
Bill

From: Johan Nel on
Hi Bill,

Know a lot of people will shoot this down, but try SQLTable instead of
SQLSelect.

Regards,

Johan Nel
Pretoria, South Africa.

On Jul 1, 11:17 am, BillT <wtill...(a)hotmail.com> wrote:
> Johan,
> I have done that, but am still having problems! I have created a new
> DW that is called from a PB on an existing window. The new DW has only
> a FixedText control and a bBrowser.
> The code on the PB is:-
>
> METHOD TestSQLPB( ) CLASS Product2List
>
>         self:oConn := SQLConnection{"GalTech2"}      //Johan's code
>         self:oSelect := SQLSelect{;
>               "SELECT * FROM tblProduct" + ;
>               "WHERE ProductID < 100 " + ;
>               "ORDER BY ProductName", self:oConn}
>
>         self:oWin := TestDW{self}
>         self:oWin:Use(self:oSelect)     // assign the SQL selection to the
> window
>         self:oWin:show()
> RETURN nil
> -------------------------------------------
> Then in the PostInit of the DW I have:-
>
> method PostInit(oWindow,iCtlID,oServer,uExtra) class TestDW
>         //Put your PostInit additions here
>     LOCAL oColumn as bDataColumn
>
>     self:oDCbBrowser1:Use(self:server, {})
>
> //Column for ProductID
>     oColumn := bDataColumn{oDCbBrowser1, self:server, "ProductId",
> #FIELD}
>     oColumn:Width := 30
>     oColumn:Caption := "ID"
>     self:oDCbBrowser1:AddColumn( oColumn )
>     self:oDCbBrowser1:OpenColumn(oColumn )
>
> return nil
> -------------------
> The PostInit code is identical to the first few lines of that which I
> already use successfully on the Parent Window.
> Now I am back to getting a similar error to that I was getting a week
> or two ago. The oColumn := bDataColumn{oDCbBrowser1 etc} is being
> rejected at runtime as Argument Number 1, Type: OBJECT, Argument:
> 6, Function: SEND, Subsystem: BASE, Error Code:33 (DATA TYPE ERROR)
>
> Also I tried a InfoBox to inspect the reccount for the oSelect and it
> showed 0.
>
> What  have I stuffed up now??
> Thanks,
> Bill

From: Bill Tillick on
Sorry to report, Johan, that there was no change when SQLSelect was
replaced with SQLTable.

Thanks,
Bill
From: BillT on
Hi Johan and Geoff,
Some progress but with another setback.

1. I moved all the SQL setup code from the TestSQLPB pushbutton, so it
is now simply:-

METHOD TestSQLPB( ) CLASS Product2List

self:oWin := TestDW{self:owner}
self:oWin:show()
RETURN nil
-------------------------------------------
Then in the PostInit of the TestDW I put the SQL setup code and also
changed the self:server statements to self:oSelect. This now works
fine PROVIDED that I remove the WHERE clause:-

method PostInit(oWindow,iCtlID,oServer,uExtra) class TestDW
//Put your PostInit additions here
LOCAL oColumn as bDataColumn

self:oConn := SQLConnection{"GalTech2"} //Johan's code
self:oSelect := SQLSelect{;
"SELECT * FROM tblProduct" + ;
" " + ; // was WHERE
ProductID < 100
"ORDER BY ProductName", self:oConn}
InfoBox{self,, Str(oSelect:RECCOUNT)}:show()

self:oDCbBrowser1:Use(self:oSelect, {})

//Column for ProductID
oColumn := bDataColumn{oDCbBrowser1, self:oSelect, "ProductId",
#FIELD}
oColumn:Width := 30
oColumn:Caption := "ID"
self:oDCbBrowser1:AddColumn( oColumn )
self:oDCbBrowser1:OpenColumn(oColumn )
return nil
--------------------

With the WHERE clause in place the number of selected records drops to
zero as shown by the embedded InfoBox.
I wonder if the ProductID in the WHERE clause needs to be qualified
somehow, but ProductName in the ORDER BY clause works ok? I have tried
tblProduct:ProductID without success. Suggestions please?

Regards,
Bill
From: BillT on
Hi Folks,
The solution was oh so simple!! I had omitted a space after
tblProduct, so the concatenated strings did not have a space before
the WHERE clause.
So all alive and well right now.

Many thanks again,
Bill