|
Home > Archive > Programming with dBASE > March 2006 > Create table issue
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Create table issue
|
|
|
| In using the create table command, when more than 18 new fields are created a compile error is generated for the assiciated form: "Program too big to compile." The form code contains less than 1300 lines. Is the limitation with the "Create Table" comman
d or elsewhere? Has any else run into this? What would be the best work around? An additional 5 fields need to be added to the table. Currently using version 2.21 b1755.
Thanks
| |
| Charlie Lutz 2006-03-14, 8:23 pm |
| In article <xapHIc6RGHA.876@news-server>, norio@sisna.com says...
> In using the create table command, when more than 18 new fields are created a compile error is generated for the assiciated form: "Program too big to compile." The form code contains less than 1300 lines. Is the limitation with the "Create Table" comm
and or elsewhere? Has any else run into this? What would be the best work around? An additional 5 fields need to be added to the table. Currently using version 2.21 b1755.
> Thanks
>
>
Remember there is a character limit to a single line of code in your
program. Your create table line is probably too long (even if on
multiple lines with ; it is still one line). I had to create the table
with partial fields and then alter the table on the next line to add the
rest of the fields.
Charlie
--
____________________
________
Charlie Lutz
#1000441
| |
| *Lysander* 2006-03-14, 8:23 pm |
| Charlie Lutz schrieb:
> Remember there is a character limit to a single line of code in your
> program. Your create table line is probably too long (even if on
> multiple lines with ; it is still one line). I had to create the table
> with partial fields and then alter the table on the next line to add the
> rest of the fields.
As an alternative, you can also put together your string, first and then
use the method "executeSQL" of the database-object to execute the
create-table statement.
ciao,
André
| |
|
| That sounds like another good alternative. I'm unfamiliar with the "executesql" command. What would be the object when using native dbase tables: _app.database[1].executesql(create table tablestring)?
Thanks for your help
Lloyd
*Lysander* Wrote:
> Charlie Lutz schrieb:
>
>
> As an alternative, you can also put together your string, first and then
> use the method "executeSQL" of the database-object to execute the
> create-table statement.
>
> ciao,
> André
>
| |
|
| Charlie Lutz <lutzc@(remove)wes.army.mil> Wrote:
> In article <xapHIc6RGHA.876@news-server>, norio@sisna.com says...
mmand or elsewhere? Has any else run into this? What would be the best work around? An additional 5 fields need to be added to the table. Currently using version 2.21 b1755.[color=darkred]
> Remember there is a character limit to a single line of code in your
> program. Your create table line is probably too long (even if on
> multiple lines with ; it is still one line). I had to create the table
> with partial fields and then alter the table on the next line to add the
> rest of the fields.
>
> Charlie
> --
>
> Great suggestion.
Thanks
Lloyd
> ____________________
________
> Charlie Lutz
> #1000441
| |
| *Lysander* 2006-03-14, 8:23 pm |
| Lloyd schrieb:
> That sounds like another good alternative. I'm unfamiliar with the "executesql" command. What would be the object when using native dbase tables: _app.database[1].executesql(create table tablestring)?
your example is already very good, if you are not _explicitely_ using
database-objects (which I would advise you to do). Because in such cases
dBase automatic sorts all your tables and queries to the
"standard"-database as you quoted.
the method "database.executeSQL(ZSTRING)" demands for a string as a
parameter.
The following example was taken from the onlinehelp, and modified for
your need:
ZV01 = new string()
ZV01 = 'CREATE TABLE "employee.dbf"'
ZV01 += '('
ZV01 += 'LAST_NAME CHAR(20),'
ZV01 += 'FIRST_NAME CHAR(15),'
ZV01 += 'SALARY NUMERIC(10,2),'
ZV01 += 'DEPT_NO SMALLINT'
ZV01 += ')'
_app.Databases[1].ExecuteSQL(ZV01)
this method, as you can see above, also helps a bit to clean up the
picture in your code, and that is very helpful whenever you look at it
some months later again :)
hope this helps,
ciao,
André
| |
| Eric Logan 2006-03-15, 8:23 pm |
| May I add something. For a good example of programatically creating tables
where the data definition code is long, run duflp cretable7.prg on a table
with many fields, then look at the code it generates. You will see that
after a 'create table' part, the rest of the fields are added by 'alter
table'.
E.L.
> Remember there is a character limit to a single line of code in your
> program. Your create table line is probably too long (even if on
> multiple lines with ; it is still one line). I had to create the table
> with partial fields and then alter the table on the next line to add the
> rest of the fields.
>
> Charlie
|
|
|
|
|