Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems with CursorAdapters cursor schema
Message
De
03/10/2003 13:44:48
 
 
À
03/10/2003 10:08:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00833764
Message ID:
00834919
Vues:
24
>>This is by design, columns in CursorSchema are matched not by name, but by their position because CursorSchema not only allows to change datatype, but allows to change column name as well. You can always use one of available CA builders just to have them generate the schema for you.
>
>What about cursorschema = "field1 n(10,2),,,,,field6 c(30)"
>

Hi Dimitris,

This is going to break design time support. I think the problem is not that big as you are trying to make it. Here is a little schema builder (not fully tested) for you.
CLOSE DATABASES all
clear

Con=SQLSTRINGCONNECT([DRIVER=SQL Server;SERVER=(local);DATABASE=Northwind;Trusted_Connection=Yes])

IF Con<1
	? "FAILED to connect!!!"
	return
ENDIF

SQLEXEC(con,"select * from customers","res")
AFIELDS(aflds)
DISPLAY STRUCTURE 

cSchema=""

FOR I=1 TO ALEN(aflds,1)
	IF I>1
		cSchema = cSchema + ", "
	ENDIF
	
	cSchema = cSchema + aflds(I,1)+" "+ aflds(I,2)
	
	DO CASE
		CASE aflds(I,2)=='C'
			cSchema = cSchema + "(" +TRANSFORM(aflds(I,3))+")"
			IF aflds(I,6)
				cSchema = cSchema + " NOCPTRANS"
			ENDIF
		CASE aflds(I,2)=='N' 
			cSchema = cSchema + "(" +TRANSFORM(aflds(I,3))+","+TRANSFORM(aflds(I,4))+")"
		CASE aflds(I,2)=='F' 
			cSchema = cSchema + "(" +TRANSFORM(aflds(I,3))+","+TRANSFORM(aflds(I,4))+")"
		CASE aflds(I,2)=='B' 
			cSchema = cSchema + "(" +TRANSFORM(aflds(I,4))+")"
		CASE aflds(I,2)=='M' 
			IF aflds(I,6)
				cSchema = cSchema + " NOCPTRANS"
			ENDIF
	ENDCASE
ENDFOR

_cliptext=cSchema
?_cliptext

RETURN 
Thanks,
Aleksey.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform