Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vfp->sqlserver
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01673150
Message ID:
01673220
Vues:
66
Creating a DTS or SSIS package in SQL Server is probably going to be the fastest way to do this if you just need to update the SQL server a few times a day. I created a way to use the VFP DBC's triggers, stored procedures, and remote views to 'live sync' VFP and SQL Server data :) I put a post out here a while back about how I did it -- it's been running for a few years and works quite well. Basically when a VFP table is updated, it triggers a stored procedure and uses a remote view to update the SQL Server.



>DO WHILE, seriosly?
>
>>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.
ICQ 10556 (ya), 254117
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform