He estado usando la instrucción
Code: Select all
FW_AdoImportFromDBF( oCn, "&dbtempo" )
Code: Select all
FW_AdoImportFromDBF( oCn, "&dbtempo" )
Code: Select all
FW_AdoImportFromDBF( oCn, "&dbtempo","&cRealdb" )
Does exist a version 7.7 of BCC? This is the latest, as far as I know:mariordz wrote:FWH 19.12
Bcc7.7
Harbour 3.2.0 dev (r1603082110)
Code: Select all
Embarcadero C++ 7.40 for Win32 Copyright (c) 1993-2018 Embarcadero Technologies, Inc.
1. Is the second table has the same structure as the first table?Buenas tardes, he estado trabajando en exportar mis datos de DBF's a una base de datos de SQL, hasta ahora todo bien, pero me gustaría saber como agrego información que tengo en una DBF temporal a una tabla SDQL que ya existe.
Code: Select all
copy to &dbtmp7 fields field1,field2,field3,...
Code: Select all
cField:="field2,field2,field3,...."
Code: Select all
tempo2sql(dbtmp7,tRepos,cField)
Code: Select all
Function tempo2sql(tempdb,realdb,cField0)
local oCn
cTemporal:=tempdb
cRealdb:=realdb
cFields=cField0
cTabtem:=cFilename(cTemporal)
close all
dbtempo:=alltrim(cTemporal)+".dbf"
oCn := FW_OpenAdoConnection( { "MSSQL", xSOURCE, xCATALOGA, xUSERID, xPASSWORD }, .t. )
if oCn == nil
? "Failed to connect"
return .f.
endif
if FW_AdoImportFromDBF( oCn, "&dbtempo" )
lImported=.T.
else
? "Import Fail"
lImported:=.F.
endif
oCn:Close()
if lImported=.T.
cCadsql0:="insert into &cRealdb select &cFields from &cTabtem"
oRs0 := TOleAuto():New( "ADODB.Recordset" )
oRs0:CursorType := 1 // opendkeyset
oRs0:CursorLocation := 3 // local cache
oRs0:LockType := 3 // lockoportunistic
TRY
cursorwait()
oRS0:Open( cCadSql0,'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial Catalog='+xCATALOGA+';User Id='+xUSERID+';Password='+xPASSWORD )
CATCH oErr
MsgInfo( "Error inserting data to the real SQL table" )
RETURN(.F.)
END TRY
cCadsql01:="drop table &cTabtem"
oRs01 := TOleAuto():New( "ADODB.Recordset" )
oRs01:CursorType := 1 // opendkeyset
oRs01:CursorLocation := 3 // local cache
oRs01:LockType := 3 // lockoportunistic
TRY
cursorwait()
oRS01:Open( cCadSql01,'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial Catalog='+xCATALOGA+';User Id='+xUSERID+';Password='+xPASSWORD )
CATCH oErr
MsgInfo( "Error dropping temporal table" )
RETURN(.F.)
END TRY
endif
return nil