Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapters and MySQL
Message
 
 
À
16/01/2004 16:27:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00867653
Message ID:
00868527
Vues:
18
This probably has nothing to do with your problem, but I would not include the CustomerID in the UpdatableFieldList.

>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
>
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform