Working with Large Forms

Roman_Candle

Member
Joined
Jan 19, 2005
Messages
10
Programming Experience
Beginner
I have a large form (30 fields) submitting to a DB (access).


When i write my SQL statements or DBCommands do i have to reference all the fields in the statement (ie ("INSERT INTO
MyTable (NUMBER, DATE, NAME,etc,etc.....30) VALUES (?, ?, ?....30)")

is there a shorter version or way of doing this?
or do i have some monster SQL statements
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
If you want to send all the data to the dataBase, you must include all the fields.
There is however, a dataForm Wizard which will create the schema and code for you.
You can also use the Data Adapter Configuration Wizard and the Query Builder to build the SQL statement visually.
 

mzim

Well-known member
Joined
Jun 3, 2004
Messages
187
Location
Other side of the rock
Programming Experience
1-3
Roman_Candle said:
I have a large form (30 fields) submitting to a DB (access).


When i write my SQL statements or DBCommands do i have to reference all the fields in the statement (ie ("INSERT INTO
MyTable (NUMBER, DATE, NAME,etc,etc.....30) VALUES (?, ?, ?....30)")

is there a shorter version or way of doing this?
or do i have some monster SQL statements

if your table has 30 fields.

you could do this:
VB.NET:
insert into mytable values(etc...30)
by not specifying the fields.
 

Schenz

Well-known member
Joined
Sep 11, 2004
Messages
181
Location
Cincinnati, OH
Programming Experience
5-10
NOTE: If you do not specify the field names you MUST Insert the data exactly in the same order as the database has it set up. You may NOT skip any of the fields, if there is nothing to Insert for a field you must either tell it to insert NULL or "".

It is much better practice to specify the field names. And in 6 months when you come back to work on that code it is easier to remember exactly what it is doing.
 
Top Bottom