Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy tables into new database
Message
From
18/12/2004 09:18:50
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
18/12/2004 04:50:03
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Novell 4.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00970292
Message ID:
00970308
Views:
15
>Hi,
>
>I want to generate a new project, what I did for the new project, I copied all files (data,forms,formset,lib,repors,other etc) which are useful for the new project. When I try to add the tables in a new database it says "Cannot add this table: it belongs to database d:\vfas\data\national.dbf". How can I add tables into my new database (newfas.dbf). Please help.
>
>Thanks

Saifuddin,
If your database doesn't contain any data yet, then generate programmatic version using gendbc. Edit generated code for new database name and run the code.

You might also programmatically change the backlink info (take a backup first as always):
* Assuming default dir is where testdata and its tables are
lcOldDBC = "testdata"
lcNewDBC = "myTestData"
RenDbc(m.lcOldDBC,m.lcNewDBC)

Function RenDbc
lparameters OldName, NewName
Open data (oldName)
lnTables=adbobject(arrTables,'TABLE')
For ix=1 to lnTables
  lcTable = arrTables[ix]+'.DBF'
  handle=fopen(lcTable,12)
  =fseek(handle,8,0)
  lnLowByte = asc(fread(handle,1))
  lnHighByte = asc(fread(handle,1))*256
  lnBackLinkstart = lnHighByte + lnLowByte - 263
  =fseek(handle,lnBackLinkstart,0)
  Fwrite(handle,forceext(newName,'dbc')+replicate(chr(0),263),263)
  =fclose(handle)
Endfor
Close data all
Rename (forceext(oldName,'dbc')) to (forceext(newName,'dbc'))
Rename (forceext(oldName,'dcx')) to (forceext(newName,'dcx'))
Rename (forceext(oldName,'dct')) to (forceext(newName,'dct'))
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform