Information générale
Catégorie:
Applications Internet
Did you go to DevDays??? If so, the VFP Presentation had an example of useing Remote Data Services with an Active Document. Here is the code for the form:
**************************************************
*-- Form: form1 (d:\documents\devdays 98\activedoc\products.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 11/03/98 11:17:13 PM
*
#INCLUDE "d:\documents\devdays 98\activedoc\adcvbs.h"
*
DEFINE CLASS form1 AS form
Top = 0
Left = 0
Height = 413
Width = 561
DoCreate = .T.
Caption = "Products"
TitleBar = 0
WindowState = 2
store_id = ""
store_name = ""
store_type = ""
store_add1 = ""
store_add2 = ""
store_add3 = ""
store_city = ""
store_state = ""
store_zip = ""
store_desc = ""
store_phone1 = ""
Name = "Form1"
*-- ADO recordset created using the RDS.DataControl.
ords = .F.
ADD OBJECT txtstore_id AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_id", ;
Height = 23, ;
Left = 108, ;
TabIndex = 2, ;
Top = 62, ;
Width = 96, ;
Name = "txtStore_id"
ADD OBJECT lblstore_id AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_id", ;
Left = 22, ;
Top = 62, ;
Width = 46, ;
TabIndex = 1, ;
Name = "lblStore_id"
ADD OBJECT txtstore_name AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_name", ;
Height = 23, ;
Left = 108, ;
TabIndex = 4, ;
Top = 90, ;
Width = 193, ;
Name = "txtStore_name"
ADD OBJECT lblstore_name AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_name", ;
Left = 22, ;
Top = 90, ;
Width = 68, ;
TabIndex = 3, ;
Name = "lblStore_name"
ADD OBJECT txtstore_type AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_type", ;
Height = 23, ;
Left = 108, ;
TabIndex = 6, ;
Top = 118, ;
Width = 57, ;
Name = "txtStore_type"
ADD OBJECT lblstore_type AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_type", ;
Left = 22, ;
Top = 118, ;
Width = 58, ;
TabIndex = 5, ;
Name = "lblStore_type"
ADD OBJECT txtstore_add1 AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_add1", ;
Height = 23, ;
Left = 108, ;
TabIndex = 8, ;
Top = 146, ;
Width = 193, ;
Name = "txtStore_add1"
ADD OBJECT lblstore_add1 AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_add1", ;
Left = 22, ;
Top = 146, ;
Width = 64, ;
TabIndex = 7, ;
Name = "lblStore_add1"
ADD OBJECT txtstore_add2 AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_add2", ;
Height = 23, ;
Left = 108, ;
TabIndex = 10, ;
Top = 174, ;
Width = 193, ;
Name = "txtStore_add2"
ADD OBJECT lblstore_add2 AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_add2", ;
Left = 22, ;
Top = 174, ;
Width = 64, ;
TabIndex = 9, ;
Name = "lblStore_add2"
ADD OBJECT txtstore_add3 AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_add3", ;
Height = 23, ;
Left = 108, ;
TabIndex = 12, ;
Top = 202, ;
Width = 193, ;
Name = "txtStore_add3"
ADD OBJECT lblstore_add3 AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_add3", ;
Left = 22, ;
Top = 202, ;
Width = 64, ;
TabIndex = 11, ;
Name = "lblStore_add3"
ADD OBJECT txtstore_city AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_city", ;
Height = 23, ;
Left = 108, ;
TabIndex = 14, ;
Top = 230, ;
Width = 193, ;
Name = "txtStore_city"
ADD OBJECT lblstore_city AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_city", ;
Left = 22, ;
Top = 230, ;
Width = 53, ;
TabIndex = 13, ;
Name = "lblStore_city"
ADD OBJECT txtstore_state AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_state", ;
Height = 23, ;
Left = 108, ;
TabIndex = 16, ;
Top = 258, ;
Width = 57, ;
Name = "txtStore_state"
ADD OBJECT lblstore_state AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_state", ;
Left = 22, ;
Top = 258, ;
Width = 63, ;
TabIndex = 15, ;
Name = "lblStore_state"
ADD OBJECT txtstore_zip AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_zip", ;
Height = 23, ;
Left = 276, ;
TabIndex = 18, ;
Top = 258, ;
Width = 90, ;
Name = "txtStore_zip"
ADD OBJECT lblstore_zip AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_zip", ;
Left = 190, ;
Top = 260, ;
Width = 51, ;
TabIndex = 17, ;
Name = "lblStore_zip"
ADD OBJECT edtstore_desc AS editbox WITH ;
Comment = "", ;
Height = 77, ;
Left = 108, ;
TabIndex = 20, ;
Top = 290, ;
Width = 257, ;
ControlSource = "ThisForm.store_desc", ;
Name = "edtStore_desc"
ADD OBJECT lblstore_desc AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_desc", ;
Left = 22, ;
Top = 290, ;
Width = 63, ;
TabIndex = 19, ;
Name = "lblStore_desc"
ADD OBJECT txtstore_phone1 AS textbox WITH ;
Comment = "", ;
ControlSource = "ThisForm.store_phone1", ;
Height = 23, ;
Left = 108, ;
TabIndex = 22, ;
Top = 370, ;
Width = 117, ;
Name = "txtStore_phone1"
ADD OBJECT lblstore_phone1 AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Store_phone1", ;
Left = 22, ;
Top = 370, ;
Width = 78, ;
TabIndex = 21, ;
Name = "lblStore_phone1"
ADD OBJECT cmdfirst AS commandbutton WITH ;
Top = 12, ;
Left = 24, ;
Height = 27, ;
Width = 60, ;
Caption = "First", ;
Name = "cmdFirst"
ADD OBJECT cmdprevious AS commandbutton WITH ;
Top = 12, ;
Left = 96, ;
Height = 27, ;
Width = 60, ;
Caption = "Previous", ;
Name = "cmdPrevious"
ADD OBJECT cmdnext AS commandbutton WITH ;
Top = 12, ;
Left = 168, ;
Height = 27, ;
Width = 60, ;
Caption = "Next", ;
Name = "cmdNext"
ADD OBJECT cmdlast AS commandbutton WITH ;
Top = 12, ;
Left = 240, ;
Height = 27, ;
Width = 60, ;
Caption = "Last", ;
Name = "cmdLast"
ADD OBJECT cmdsave AS commandbutton WITH ;
Top = 12, ;
Left = 312, ;
Height = 27, ;
Width = 60, ;
Caption = "Save", ;
Name = "cmdSave"
ADD OBJECT cmdrefresh AS commandbutton WITH ;
Top = 12, ;
Left = 384, ;
Height = 27, ;
Width = 60, ;
Caption = "Refresh", ;
Name = "cmdRefresh"
PROCEDURE store_id_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
THIS.Store_id = m.vNewVal
This.oRDS.Recordset.Fields("store_id").Value = vNewVal
ENDPROC
PROCEDURE store_name_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
vNewVal = Alltrim(vNewVal)
THIS.Store_name = vNewVal
This.oRDS.Recordset.Fields("store_name").Value = vNewVal
ENDPROC
PROCEDURE store_type_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
THIS.Store_type = m.vNewVal
This.oRDS.Recordset.Fields("store_type").Value = vNewVal
ENDPROC
PROCEDURE store_add1_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
vNewVal = Alltrim(vNewVal)
THIS.Store_add1 = m.vNewVal
This.oRDS.Recordset.Fields("store_add1").Value = vNewVal
ENDPROC
PROCEDURE store_add2_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
vNewVal = Alltrim(vNewVal)
THIS.Store_add2 = m.vNewVal
This.oRDS.Recordset.Fields("store_add2").Value = vNewVal
ENDPROC
PROCEDURE store_add3_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
vNewVal = Alltrim(vNewVal)
THIS.Store_add3 = m.vNewVal
This.oRDS.Recordset.Fields("store_add3").Value = vNewVal
ENDPROC
PROCEDURE store_city_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
vNewVal = Alltrim(vNewVal)
THIS.Store_city = m.vNewVal
This.oRDS.Recordset.Fields("store_city").Value = vNewVal
ENDPROC
PROCEDURE store_state_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
vNewVal = Alltrim(vNewVal)
THIS.Store_state = m.vNewVal
This.oRDS.Recordset.Fields("store_state").Value = vNewVal
ENDPROC
PROCEDURE store_zip_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
vNewVal = Alltrim(vNewVal)
THIS.Store_zip = m.vNewVal
This.oRDS.Recordset.Fields("store_zip").Value = vNewVal
ENDPROC
PROCEDURE store_desc_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
vNewVal = Alltrim(vNewVal)
THIS.Store_desc = m.vNewVal
This.oRDS.Recordset.Fields("store_desc").Value = vNewVal
ENDPROC
PROCEDURE store_phone1_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
vNewVal = Alltrim(vNewVal)
THIS.Store_phone1 = m.vNewVal
This.oRDS.Recordset.Fields("store_phone1").Value = vNewVal
ENDPROC
PROCEDURE showvalues
With This
.txtStore_name.Value = .oRDS.Recordset.Fields("store_name").Value
.txtStore_add1.Value = .oRDS.Recordset.Fields("store_add1").Value
.txtStore_add2.Value = .oRDS.Recordset.Fields("store_add2").Value
.txtStore_add3.Value = .oRDS.Recordset.Fields("store_add3").Value
.txtStore_city.Value = .oRDS.Recordset.Fields("store_city").Value
.txtStore_id.Value = .oRDS.Recordset.Fields("store_id").Value
.edtStore_desc.Value = .oRDS.Recordset.Fields("store_desc").Value
.txtStore_phone1.Value = .oRDS.Recordset.Fields("store_phone1").Value
.txtStore_state.Value = .oRDS.Recordset.Fields("store_state").Value
.txtStore_type.Value = .oRDS.Recordset.Fields("store_type").Value
.txtStore_zip.Value = .oRDS.Recordset.Fields("store_zip").Value
EndWith
This.Refresh
ENDPROC
PROCEDURE Init
This.oRDS = CreateObject("rds.datacontrol")
If Type("This.oRDS") <> "O"
MessageBox("oRDS not created")
Else
With This.oRDS
.Server = "http://jvp"
.Connect = "dsn=dsnFitch_Mather"
.SQL = "Select * from stores"
.ExecuteOptions = adcExecSync
.FetchOptions = adcFetchBackground
.Refresh
EndWith
This.ShowValues
EndIf
ENDPROC
PROCEDURE Destroy
This.oRDS = .Null.
Clear Events
ENDPROC
PROCEDURE cmdfirst.Click
ThisForm.oRDS.RecordSet.MoveFirst
ThisForm.ShowValues
ENDPROC
PROCEDURE cmdprevious.Click
ThisForm.oRDS.RecordSet.MovePrevious
If ThisForm.oRDS.RecordSet.Bof
ThisForm.oRDS.RecordSet.MoveFirst
EndIf
ThisForm.ShowValues
ENDPROC
PROCEDURE cmdnext.Click
ThisForm.oRDS.RecordSet.MoveNext
If ThisForm.oRDS.RecordSet.Eof
ThisForm.oRDS.RecordSet.MoveLast
EndIf
ThisForm.ShowValues
ENDPROC
PROCEDURE cmdlast.Click
ThisForm.oRDS.RecordSet.MoveLast
ThisForm.ShowValues
ENDPROC
PROCEDURE cmdsave.Click
ThisForm.oRDS.SubmitChanges()
ENDPROC
PROCEDURE cmdrefresh.Click
ThisForm.oRDS.Refresh
ThisForm.ShowValues
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement