Source language: Translate to:

Creating tables on runtime

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Creating tables on runtime

Postby carlos torres » Sat Jun 16, 2007 5:01 pm

I want to create an Access database on runtime if it doesn't exist... it works fine. I check for tables also if it doesn't exist I create it .... but when I try to create a numeric field as Mark1, NB shows a warning message about a syntax error creating table.

This is the code

Code: Select all
dbpCreateTable "DbLst" "Student" "Code String(35);LastName String(35);Names String(35);Group String(1);Status Boolean Default=True;MARK1 Float(4,1)


When I suppress the last field it woks fine.

How can I avoid this?
I will appreciate any suggestion

regards
carlost
User avatar
carlos torres
 
Posts: 289
Joined: Mon May 02, 2005 8:14 am
Location: Pamplona, Colombia

Postby Wrangler » Sun Jun 17, 2007 8:50 am

dbpCreateTable "DbLst" "Student" "Code String(35);LastName String(35);Names String(35);Group String(1);Status Boolean Default=True;MARK1 Float(4,1)


This command is missing the quotation marks at the end. Typo?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Gaev » Sun Jun 17, 2007 9:35 am

carlost:

Try ...
Code: Select all
dbpCreateTable "DbLst" "Student" "Code String(35);LastName String(35);Names String(35);Group String(1);Status Boolean Default=True;MARK1 Float"


i.e. just the word Float ... it did not produce the error response that Float(4,1) did.

I could not find one official specification of field types/definitions ... perhaps because different versions of Access support different field types ... but my search revealed this web page at Miscrosoft's Developer Network website ... http://msdn2.microsoft.com/en-us/library/bb208866.aspx ... where they defined ...
Data type Storage size
Description


BINARY 1 byte per character
Any type of data may be stored in a field of this type. No translation of the data (for example, to text) is made. How the data is input in a binary field dictates how it will appear as output.

BIT 1 byte
Yes and No values and fields that contain only one of two values.
TINYINT 1 byte
An integer value between 0 and 255.

MONEY 8 bytes
A scaled integer between – 922,337,203,685,477.5808 and 922,337,203,685,477.5807.

DATETIME (See DOUBLE) 8 bytes
A date or time value between the years 100 and 9999.

UNIQUEIDENTIFIER 128 bits
A unique identification number used with remote procedure calls.

REAL 4 bytes A single-precision floating-point value with a range of – 3.402823E38 to – 1.401298E-45 for negative values, 1.401298E-45 to 3.402823E38 for positive values, and 0.

FLOAT 8 bytes
A double-precision floating-point value with a range of – 1.79769313486232E308 to – 4.94065645841247E-324 for negative values, 4.94065645841247E-324 to 1.79769313486232E308 for positive values, and 0.

SMALLINT 2 bytes
A short integer between – 32,768 and 32,767. (See Notes)

INTEGER 4 bytes
A long integer between – 2,147,483,648 and 2,147,483,647. (See Notes)

DECIMAL 17 bytes
An exact numeric data type that holds values from 1028 - 1 through - 1028 - 1. You can define both precision (1 - 28) and scale (0 - defined precision). The default precision and scale are 18 and 0, respectively.

TEXT 2 bytes per character (See Notes)
Zero to a maximum of 2.14 gigabytes.

IMAGE As required
Zero to a maximum of 2.14 gigabytes. Used for OLE objects.

CHARACTER 2 bytes per character (See Notes)
Zero to 255 characters.

Note that they talk about TEXT fields having 2.14 GB capacity ... elsewhere I read that TEXT fields can be a maximum of 255 characters ... and MEMO fields are required to handle text greater than 255.
User avatar
Gaev
 
Posts: 3737
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Wrangler » Sun Jun 17, 2007 9:44 am

I don't think a workaround should be used here.

dbpCreateTable "mydb" "" "testthis Float(4,1)"

is the way the wizard creates it. It should just work, or it is a bug.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Gaev » Sun Jun 17, 2007 12:45 pm

Wrangler:
dbpCreateTable "mydb" "" "testthis Float(4,1)"

is the way the wizard creates it.

Sorry, I didn't realize that was what the wizard was producing.

It should just work, or it is a bug.

Does the syntax Float(4,1) work for you ?

- if it does, it might be that different versions of the MS Access drivers (installed on different machines) expect/accept different syntaxes

- if it does not, it could be a bug in the wizard.

I don't think a workaround should be used here.

If Float(4,1) does not work everywhere, Dave would have to fix the wizard

If it works on some machines, the wizard may have to be "made smarter" ?

... something for Dave to advise upon
User avatar
Gaev
 
Posts: 3737
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Wrangler » Sun Jun 17, 2007 3:49 pm

Nope. Doesn't work for me neither. I have Office 2003 installed.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Neosoft Support » Mon Jun 18, 2007 10:55 am

It sounds like Access doesn't support the optional size and precision parameters of the float field type. Other types of databases do support these options.

I expect that there will be several things like this because there are many inconsistencies in how fields are interpreted by different databases. It seems almost no one completely supports the standard SQL data types.

Please report any other problems of this type so that the wizard can be corrected.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest

cron