In your solutions <Browser Name>:SetAdo(<Record set Name>)is used for showing recordset data. But in TSBrowser7 doesn’t have SetAdo Method. So I download TSBrower ver 8 (Link provide in FiveWin Forum) and tried to make lib file. But I can’t make TSBrowse Lib file and when I read the TsBrowse ver 8 Source code, SetAdo() function in source prg file, seams to be commented and 2 sub method AdoSkip() and AdoGenFldBlk() used by SetAdo method is missing.
I am struck right now with TSBrowse ver 8.
Is it possible to get any help from the experts of this forum on displaying recordset data of Microsoft Sql 2005 on TsBrowse. 7 or TsBrowse ver 8
I am herewith pasting the my code for connecting to SQL Server
Connection String
- Code: Select all Expand view RUN
CnAdo:=CreateObject("ADODB.Connection")
CnAdo:Open("Provider=MSDASQL;driver=SQL
Server;Server=SANIL\SQLEXPRESS;Uid=sa;Pwd=sa;Database=dbpdms;")
RsAdo:=CreateObject("ADODB.Recordset")
TSBrowse Definition
DEFINE WINDOW FRMSPARE;
AT GetDesktopRealTop()+40,GetDesktopRealLeft();
WIDTH GETDESKTOPREALWIDTH();
HEIGHT GETDESKTOPREALHEIGHT()-60;
NOMAXIMIZE NOSIZE;
TITLE "Spare Parts";
ICON "PDMS";
ON INTERACTIVECLOSE Frm_Close("Spare Parts","N");
CHILD
DEFINE TBROWSE oTBrw_Spare AT 320,5;
OF FRMSPARE WIDTH (GETDESKTOPREALWIDTH()-25) HEIGHT 320 CELLED
Sql_Query :="sp_PartType '"+ SqlSelect +"','" + COMPANYCD + "','" +
BRANCHCD + "','" + CENTERTYPE + "'"
If RsAdo:State ==1
RsAdo:Close()
Endif
RsAdo:Open(Sql_Query,CnAdo,2,3)
SetDb(oTBrw_Spare)
ADD COLUMN TO oTBrw_Spare ;
HEADER "Part Name" ;
DATA {||RsAdo:Fields["Part_Type_Desc"]:Value};
3DLOOK FALSE SIZE 700
END TBROWSE
oTBrw_Spare:Refresh()
END WINDOW
*---------------------------------------------------------------------------
Procedure SetDb(oTBrw_Spare)
*---------------------------------------------------------------------------
oTBrw_Spare:nRowPos := 1
oTBrw_Spare:nColPos := 1
oTBrw_Spare:nCell := 1
oTBrw_Spare:lHitTop := .F.
oTBrw_Spare:lHitBottom := .F.
oTBrw_Spare:HiliteCell( 1 )
oTBrw_Spare:bLogicLen := {|| RsAdo:RecordCount() }
oTBrw_Spare:bGoTop := {|| RsAdo:GoTop() }
oTBrw_Spare:bGoBottom := {|| RsAdo:GoBottom() }
oTBrw_Spare:bSkip := {|nSkip|fSkipper(nSkip)}
oTBrw_Spare:nLen := Eval(oTBrw_Spare:bLogicLen)
return
*--------------------------
Function fSkipper(nRecs)
*--------------------------
local nSkipped := 0
IF !RsAdo:Eof()
Do Case
Case nRecs == 0
Case nRecs > 0
WHILE nSkipped < nRecs
IF !RsAdo:Eof()
RsAdo:Skip(1)
IF RsAdo:Eof()
RsAdo:Gobottom()
EXIT
ENDIF
nSkipped++
ENDIF
ENDDO
Case nRecs < 0
DO WHILE nSkipped > nRecs
IF .NOT. RsAdo:Bof()
RsAdo:Skip(-1)
IF RsAdo:Bof()
RsAdo:Gotop()
EXIT
ENDIF
nSkipped--
ENDIF
ENDDO
End Case
ENDIF
RETURN nSkipped