Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vfp->sqlserver
Message
 
 
À
26/02/2020 07:30:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01673150
Message ID:
01673215
Vues:
69
Below is the snippet of the code of how I do it (with some comments):
*-- Create a text string that will be used in inserting new records from DBF to SQL Table  
TEXT TO cSqlInsert NOSHOW
      INSERT INTO SITES
      ( SITE_ID, SITE_DESC, SITE_NO )
      VALUES 
      ( ?SITES.SITE_ID, ?SITES.SITE_DESC, ?SITES.SITE_NO ) 
ENDTEXT

*-- Select DBF table (e.g. table "SITES")
SELECT SITES

lCountRec = 0
			
*-- Go through all records in the DBF table
GO TOP 
DO WHILE !EOF()
	    *--- Insert the record into the SQL table	
	    nResult = SQLEXEC(hCon, cSqlInsert)	
				
  	IF nResult < 1
		AERROR( aErrorInf )

		*-- Call to my error check routing...
		IF !Problem_Choice( "SITES", aErrorInf[1,2], RECNO("SITES") )
			EXIT 
		ENDIF 

       ELSE 
		
		*-- Count successfully added record
		lCountRec = lCountRec + 1
				
	ENDIF

	SKIP IN SITES

ENDDO 
>the wizard created all table but about of them are empty
>i tied to insert manually but it wont work
>the connection is made (returns a value >0)
>here is the statement
> ? SQLExec( lnHandle , "INSERT INTO dos (os_id,osdate,osname,ostype_id ) values (cc2.os_id,cc2.osdate,cc2.osname,cc2.ostype_id)")
>
>what could be the problem
>
>
>Thanks
>
>Peter
>
>
>>I don't use the upsize wizard. Instead I created a PRG which goes, table by table, and copies the data from VFP to the SQL DB. I know it takes more time to create such a PRG but if you need to do upsizing multiple times (my case), it pays off.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform