Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapters and MySQL
Message
From
16/01/2004 16:27:29
 
 
To
16/01/2004 16:17:51
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00867653
Message ID:
00867670
Views:
17
Here's the code do define my class.
DEFINE CLASS Customers as CursorAdapter
  cConnStr = "<<myconnstring>>"
  Tables = "Customers"

  KeyFieldList = "CustomerID"
	
  UpdatableFieldList = "CustomerID, " +;
     		       "CompanyName, " +;
		       "ContactName, " +;
                       "ContactTitle, " +;
                       "Address, " +;
		       "City, " +;
		       "Region, " +;
		       "PostalCode, " +;
                       "Country, " +;
		       "Phone, " +;
		       "Fax"
							
  UpdateNameList = "CustomerID Customers.CustomerID,  " +;
		   "CompanyName Customers.CompanyName,  " +;
		   "ContactName Customers.ContactName,  " +;
		   "ContactTitle Customers.ContactTitle,  " +;
		   "Address Customers.Address,  " +;
		   "City Customers.City,  " +;
		   "Region Customers.Region,  " +;
 		   "PostalCode Customers.PostalCode,  " +;
		   "Country Customers.Country,  " +;
		   "Phone Customers.Phone,  " +;
		   "Fax Customers.Fax"
						  
  AllowUpdate = .t.
  AllowInsert = .t.
  AllowDelete = .t.
  SendUpdates = .t.
  Alias = "Customers"
  BufferModeOverride = 5
		
  FUNCTION Init(lcCustomerID) as Boolean
    LOCAL lnCon as Integer, llRetVal as Boolean 
		
    SET MULTILOCKS ON 
    lnCon = SQLSTRINGCONNECT(this.cConnStr)		
    IF lnCon > 0

      WITH This
        .DataSource = lnCon
				
        .SelectCmd = ;
          "select * from Customers where CustomerID = ?lcCustomerID"							 
	.DataSourceType = "ODBC" 
				
	IF NOT .CursorFill()
  	  llRetVal = .f.
	ELSE
 	  llRetVal = .t.
	ENDIF
				
      ENDWITH
    ELSE
	llRetVal = .f.
    ENDIF
				
  ENDFUNC 
	
  FUNCTION Destroy()
	
    IF This.DataSource > 0
      SQLDISCONNECT(This.DataSource)
    ENDIF
		
    RETURN DODEFAULT()
  ENDFUNC 
	
ENDDEFINE 
Then I do:
loCustomers = NEWOBJECT('Customers', 'test.prg', NULL, "ALFKI")
Then browse the cursor, make a change and issue a TABLEUPDATE(). TABLEUPDATE() returns FALSE. I can get the following error message:
Connectivity error: Unable to retrieve specific error information.  Driver is probably out of resources
>>I'm having problems with CursorAdapters and MySql database. The database will not update. I've done some research on this and found that this is a known problem. It apparently has been reported to Microsoft, but they claim it is a problem with the ODBC Driver provided by MySql.
>>
>>However, updates via Remote Views and SQL Passthrough work with the same driver.
>>
>>Has anybody been able to get this to work with CursorAdapters?
>
>Hi Dan,
>
>Which CursorAdapter properties do you set and how do you set them?
>
>Thanks,
>Aleksey.
Thanks,
Dan Jurden
djurden@outlook.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform