Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Update auto-increment field using ASP form

Community Beginner ,
Jan 05, 2011 Jan 05, 2011

I'm using Dreamweaver 3, and have created dynamic tables using the ASP tools. One wall I've hit:

when creating an Insert Record form, how do I set up the form to update an Auto-Increment field in Access?

I have what I think is a good book on Dreamweaver, but this function isn't discussed. If I omit the field from

the form, it leaves the field null and I get a database error, as I would expect.

Any help or links to documentation will be appreciated.

Joe

TOPICS
Server side applications
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jan 06, 2011 Jan 06, 2011

As others have said, the database should handle that field and it shouldn't appear either on the form on the update page or in the code that does the actual insert.

You do it slightly differently depending on whether you use the Insert Wizard or build the form by hand and then apply the Insert Server Behaviour.

If you use the wizard, when you select the form fields, make sure you click on auto-incrementing field and then click the "minus" icon, this will remove it from the form and it will not be

...
Translate
Guest
Jan 05, 2011 Jan 05, 2011

You should be able to set the column to auto-increment in your database table application when creating the column.

Here's more info found by searching google for ASP auto-increment.

http://www.w3schools.com/sql/sql_autoincrement.asp

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 05, 2011 Jan 05, 2011

I'll browse the web for some ASP references. I was asking from the point of view of Dreamweaver, if it has wizards or other automated functions that can enable this for me, much the way it creates the code for the rest of the ASP form. I'm not averse to learning to code it manually, but with the boatload of features built into Dreamweaver, I'll take the help where I can get it.

Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 05, 2011 Jan 05, 2011

Maybe I don't understand what you are asking. You really shouldn't update an auto-increment field. That's the job of the DBMS. Are you trying to change the value that the DBMS provides?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 05, 2011 Jan 05, 2011

Maybe the title "Update field.." was misleading; I changed it. I'm referring to new records, not existing ones. 

One of the fields is an auto-number field in MsAccess. When a user enters a new record using the Insert Record form

I created in Dreamweaver, I can't figure out how to have that value be automatically filled in, the way it would in native forms

in Access. If I omit the field from the insert form, the post is rejected because it leaves the auto-number field null.

I hope this explains it better. This might be a topic for an ASP forum, not specific to Dreamweaver.

Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 05, 2011 Jan 05, 2011

As bregent and myself has previously stated, use your database management application to assign the column as an auto-increment field.

The link I provided in the first reply didn't help?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 05, 2011 Jan 05, 2011

You can't simply remove the field from the form. You need to make sure that field is not part of the recordset/insert statement.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 06, 2011 Jan 06, 2011

As others have said, the database should handle that field and it shouldn't appear either on the form on the update page or in the code that does the actual insert.

You do it slightly differently depending on whether you use the Insert Wizard or build the form by hand and then apply the Insert Server Behaviour.

If you use the wizard, when you select the form fields, make sure you click on auto-incrementing field and then click the "minus" icon, this will remove it from the form and it will not be included in the auto-generated code, leaving MS Access free to handle it itself.

If you build the form by hand, do not include a form element for the auto-incrementing field, then when you apply the Insert behaviour it will not be included in the auto-generated code, leaving MS Access free to handle it itself.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 06, 2011 Jan 06, 2011
LATEST

Some days will be better than others. The correct answers were in the discussion - omit the auto-number field

from the recordset. I was sure that I had done that, but maybe didn't save the changes, maybe what, I don't know.

Thanks for the replies and sorry for the frustration and confusion.

jb

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines