FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Question about SQL
Posts: 47
Joined: Thu Jan 05, 2006 06:56 PM
Question about SQL
Posted: Thu Nov 22, 2007 10:42 AM
Vailton Renato
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Question about SQL
Posted: Thu Nov 29, 2007 05:14 AM

Hello,

Is there a small sample program available that allows me to connect to a table, browse, search, add a record, edit a record and delete a record. I am considering switching from DBF to SQL; but I am completely new to SQL. I own MSSQL, but my clients may want to use a less expensive version of SQL, what SQL would you recommend? What would be a good reference guide for converting my application to SQL especially converting the data? I would also need to write web based code to access the same SQL data. I would appreciate your feedback.

Thank you!

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 711
Joined: Thu Oct 06, 2005 09:57 PM
Question about SQL
Posted: Sun Dec 30, 2007 06:42 PM
Rick Lipkin wrote:Michel
@ 0, 0 LISTBOX oBrow FIELDS ;
oRs:Fields("CODE"):Value, ;
oRs:Fields("DESC"):Value, ;
oRs:Fields("progid"):Value ;
SIZES 80,250,80 ;
HEADERS "Code", ;
"Description", ;
"ProgID" ;
of oGRP


Rick,

I am using that code (Thanks to RF) with Oracle DB successfully. But with table (dbf) i was using "oLbx:={|| IIF((oLbx:cAlias)->(OrdKeyNo())%2==0,CLR_LGREEN,CLR_LGRAY)}" for changing rows colors and now i can not using with array. Do you know how i can doing?

Regards
Un saludo



Manuel
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Question about SQL
Posted: Sun Dec 30, 2007 06:52 PM
Please try
oLbx:nClrPane:={|| IIF(oRs:AbsolutePisition % 2==0,CLR_LGREEN,CLR_LGRAY)}
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Question about SQL
Posted: Sun Dec 30, 2007 07:08 PM

Sorry
AbsolutePosition
not
AbsolutePisition

Sorry for the spelling mistake

Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Question about SQL
Posted: Sun Dec 30, 2007 08:59 PM

Manuel

Try this code based on a specific fields in your table .. the colors are based on dates in each row..

Rick

  oBRW:nClrText      := ;

{ || SelColor( oRs:Fields("code"):Value,oRs:Fields("DEL_CODE"):Value,oRs:Fields("EXPIR_DATE"):Value,oRs:Fields("DELETED"):Value,"F" ) }
oBRW:nClrPane := ;
{ || SelColor( oRs:Fields("code"):Value,oRs:Fields("DEL_CODE"):Value,oRs:Fields("EXPIR_DATE"):Value,oRs:Fields("DELETED"):Value,"B" ) }
oBrw:nClrForeFocus := ;
{ || SelColor( oRs:Fields("code"):Value,oRs:Fields("DEL_CODE"):Value,oRs:Fields("EXPIR_DATE"):Value,oRs:Fields("DELETED"):Value,"F" ) }

//------------------------------
Static Func SelColor( cCODE,cDEL,dEXP,dDEL,cTYPE )

LOCAL nCOLOR := CLR_BLACK

IF EMPTY(dEXP)
dEXP := CTOD("00/00/00")
ENDIF

IF EMPTY(dDEL)
dDEL := CTOD("00/00/00")
ENDIF

DO CASE
CASE cTYPE = 'F'

 IF cDEL <> "  " .and. dDEL = CTOD("00/00/00")
    nCOLOR := CLR_WHITE                    // red
 ELSE
    nCOLOR := CLR_BLACK
 ENDIF

CASE cTYPE = 'B'

 DO CASE
 CASE dEXP < DATE() .and. dDEL = CTOD("00/00'00")
    nCOLOR := RGB(255,255,0)               // yellow

 CASE cCODE <> "98" .and. cCODE <> "  " .and.;
                   cCODE <> "**"
    nCOLOR := RGB(255,128,0)              // orange

 CASE cDEL <> "  " .and. dDEL = CTOD("00/00/00")
    nCOLOR := RGB(192,3,51)                // red

 OTHERWISE
    nCOLOR := CLR_WHITE
 ENDCASE

ENDCASE

RETURN( nCOLOR )

Posts: 711
Joined: Thu Oct 06, 2005 09:57 PM
Question about SQL
Posted: Sun Dec 30, 2007 09:06 PM
nageswaragunupudi wrote:Please try
oLbx:nClrPane:={|| IIF(oRs:AbsolutePosition % 2==0,CLR_LGREEN,CLR_LGRAY)}


Thank very much Nageswara. Now all it is ok.
Un saludo



Manuel
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Question about SQL
Posted: Mon Dec 31, 2007 07:23 AM
Rick Lipkin wrote:

I wrote a thread on the subject with samples:

http://fivetechsoft.com/forums/viewtopi ... &highlight



Rick,

I put an entry based on your ADO article in the wiki at this section
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 711
Joined: Thu Oct 06, 2005 09:57 PM
Question about SQL
Posted: Mon Dec 31, 2007 05:54 PM
Rick Lipkin wrote:Manuel

Try this code based on a specific fields in your table .. the colors are based on dates in each row..


Rick thanks.

I had seen now we are seven FW-Oracle ( You, Metaldrummer (Chile), NageswaRao (India), tnhoe (Malasya), BielEA6DD, Baxajaun and I from Spain. I believe we must work together to develope this marvellous tools, (now free in Express version) and help new friends would like to work with FW + Oracle.

Happy New Year.
Un saludo



Manuel
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Question about SQL
Posted: Mon Dec 31, 2007 06:03 PM

Manuel

Good luck with Oracle .. you need to have an installed Client for Oracle for msdora and or oraoledb .. not native to Windows OS like Sql server.

Haven't had much luck in that areana. I am running Vista and the Ora9i cd's I use have a compatability alert when I try to install the setup ..

I kinda gave up on Oracle and ADO for now .. if you have any luck or can point me in the direction to a 'vista' compatable Oracle client .. please let me know.

Rick Lipkin

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Question about SQL
Posted: Tue Jan 01, 2008 04:42 AM

Friends

I would be happy to share my experiences in working with Oracle. Likewise I like to be benefited by others experiences as well. My involvement with Oracle is not limited to just using ADO, but includes PL/SQL, making Oracle packages and interfacing them with ADO.

Regards



G. N. Rao.

Hyderabad, India
Posts: 711
Joined: Thu Oct 06, 2005 09:57 PM
Question about SQL
Posted: Tue Jan 01, 2008 06:27 PM
nageswaragunupudi wrote:Friends

I would be happy to share my experiences in working with Oracle.


Thanks Nageswara.

Actually, I am using oRecordSet:Find() successfully in a browse, but when I try to use oRecordSet:Filter I received an error.

Do you know if we can use oRs:FILTER with ADO/ORACLE?

On next 8th January, I will begin a PL course. I hope interchange experiences with you.

Regards
Un saludo



Manuel
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Question about SQL
Posted: Wed Jan 02, 2008 12:01 AM

These are some examples

oRs:Filter := 'COUNTRY LIKE 'IT%'
oRs:Filter := 'AMOUNT > 1000'

Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Question about SQL
Posted: Wed Jan 02, 2008 12:39 AM

Just a quick note here .. don't forget to clear your filters like this

oRs:Filter := ""

Clearing the filter will re-set the recorset and give you back access to your origional 'fetch'

oRs:Requery() is a useful tool as well as oRs:ReSync(1,2) .. do not leave the resync parameters out .. and you MUST have a 'primary key' set on your table for the Resync method to work.

ReSync is a must in a networked environment especially for workstation update visability... if you use local recordsets ( which I recommend )

Rick Lipkin

Posts: 711
Joined: Thu Oct 06, 2005 09:57 PM
Question about SQL
Posted: Wed Jan 02, 2008 04:36 AM
nageswaragunupudi wrote:These are some examples

oRs:Filter := 'COUNTRY LIKE 'IT%'
oRs:Filter := 'AMOUNT > 1000'


Thanks Nageswara. Now all it is ok.

Regards
Un saludo



Manuel