Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with TABLEUPDATE
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00720907
Message ID:
00721656
Views:
8
Yep sure - this is my method where I open the tables - in this example I am only opening one...
LPARAMETERS strDBPath
* open tables for this object
IF !USED('sysoptions') THEN 
	USE (strDBPath + "sysoptions") IN 0 ALIAS sysoptions SHARED
ENDIF 
SELECT sysoptions
CURSORSETPROP("Buffering", 5, "sysoptions") && set optimistic row buffering on
LOCATE 
THISFORM.pMainTable = "sysoptions"
RETURN .T.
This is the code in the update method
LPARAMETERS strTableField, unkValue
LOCAL intAlias, strTable
* test passed data
IF VARTYPE(strTableField) <> "C" OR NOT "." $ strTableField THEN 
	RETURN -1 && invalid field name
ENDIF 

IF TYPE("unkValue") <> TYPE(strTableField) THEN 
	RETURN -2 && data type mismatch
ENDIF 

intAlias = SELECT() && save current work area
strTable = LEFT(strTableField, AT(".", strTableField) -1) && get the table name passed
IF NOT USED(strTable) THEN && the table passed is not open
	RETURN -3
ENDIF 

SELECT (strTable) && select the table
REPLACE (strTableField) WITH unkValue

IF NOT EMPTY(intAlias)
	SELECT (intAlias)
ELSE
	SELECT 0
ENDIF
RETURN 1 && all done 
This is the code in VB...
I create a reference to object in "References" then this

Option Explicit
Dim oHub As New datahub.dhsys

And in the click of the button...
Private Sub Command4_Click()
Dim intResult As Integer
Dim blnResult As Boolean
intResult = oHub.mreplacefield("sysoptions.so_company", Trim(txt(0).Text))
blnResult = oHub.mupdate()
End Sub
I hope this is enough!
Chris Maiden
Email
Web
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform