I want to register my input information in the database (ACCESS).

Asked 2 years ago, Updated 2 years ago, 37 views

I created two pull-down lists of SQL statements from ACCESS on the web screen and one pull-down list of sticky statements.I'd like to register what I selected from the pull-down list in the database, but it doesn't work as expected.
·The pull-down list is configured by SQL from the information in ACCESS, so the ACCESS is connected.
·The three selected items are included in the variables pstrItem1, pstrItem2, and pstrItem3.After selecting three of the pull-down lists, pressing the registration button, you can see the output on the "Do you really want to register with the following information?" screen.
For example, the table name is personal information, and the three fields are gender (pstrItem1), age (pstrItem2), and province (pstrItem3).
The table name has been substituted elsewhere in TABLEENAME.
With that in mind, please look at the program below.

SubSetsql_Insert()
DbCon_SQL="INSERT INTO"&TABLEENAME&("
DbCon_SQL=DbCon_SQL& "Gender, Age, Country of Living"
DbCon_SQL=DbCon_SQL&")VALUES("
DbCon_SQL=DbCon_SQL&com.Ex_SQLDecode(com.chrRep(pstrItem1))
DbCon_SQL=DbCon_SQL&", "com.Ex_SQLDecode(com.chrRep(pstrItem2)))
DbCon_SQL=DbCon_SQL&", "com.Ex_SQLDecode(com.chrRep(pstrItem3))"
DbCon_SQL=DbCon_SQL&)"

It uses the SQL insert statement.
This is

Call Setsql_Insert()

I tried to call in to register, but I couldn't register in the database (ACCESS) at all...

I am improving the program that was originally created by others and updating it, and I am still not familiar with ASP and SQL, so I may not understand the content of the question, but I appreciate your cooperation.We will add additional information such as additional explanations at any time, so please let us know your comments.

untagged

2022-09-30 21:30

1 Answers

I understand that the code is not accurate, so I may have considered it incorrectly, but
The concatenation part of DbCon_SQL (lines 5 and 6) must be modified as follows to concatenate strings.
I think you should check if there are any errors in the current SQL.

DbCon_SQL="INSERT INTO"&TABLEENAME&("
DbCon_SQL=DbCon_SQL& "Gender, Age, Country of Living"
DbCon_SQL=DbCon_SQL&")VALUES("
DbCon_SQL=DbCon_SQL&com.Ex_SQLDecode(com.chrRep(pstrItem1))
DbCon_SQL=DbCon_SQL&", "&com.Ex_SQLDecode(com.chrRep(pstrItem2)))
DbCon_SQL=DbCon_SQL&", "&com.Ex_SQLDecode(com.chrRep(pstrItem3))
DbCon_SQL=DbCon_SQL&)"


2022-09-30 21:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.