Changan 's error: Table name or field name with SQL keyword

xiaoxiao2021-03-06  46

Going back to the classmates on weekends, he built a table called User and tested it with JDBC. Get an abnormality of "there is a syntax error near User". The reason is that User is the SQL keyword. SQL = "Select * from user" ------------------------------------ User is SQL keyword Solve: Change to SQL = "Select * from [user]" and recall the previous project, there is a field name called Option, and the Option is the SQL keyword. In the future, I have to have this awareness, and then check the relevant information to see if the key is used. There is a better habit to add prefix before the table name and field name, such as all the table names plus T_.

转载请注明原文地址:https://www.9cbs.com/read-52359.html

New Post(0)