Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was ask to create a website that allow a user to enter the Question with an
answer on the website. when I click the button add, Question and Answer will
be store into an access database with ID number (AutoNumber). Below is the
code for my website.
Protected Sub btnQuestion_Click(...............)Handles btnQuestion.Click
lblDisplay.Text = "Question:" & txtQuestion.Text & "<br />"
lblDisplay.Text = "Answer:" & txtAnswer.Text


adsRevision.InsertParameters("Question").DefaultValue = txtQuestion.Text
adsRevision.InsertParameters("Answer").DefaultValue = txtAnswer.Text
adsRevision.Insert()

End Sub


Please,Can anyone help provide the code for AutoNumber ID? I don't know
how to write.
Posted
Updated 1-Oct-13 10:46am
v2
Comments
Richard C Bishop 1-Oct-13 16:48pm    
I know in an MS SQL database there is a property that increments the primary key when an entry is added. You might look up the equivalent to "IsIdentity" for access.
Homero Rivera 1-Oct-13 19:59pm    
You need to add the SQL code you are trying to run as well, just incase. The error is evidently in the SQL code, not the VB, your VB looks just fine (in rule). If you are not sure your sql is right, well at least let us see it!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900