Home > front end >  Used in the SQL "& a" & error
Used in the SQL "& a" & error

Time:11-30

Do a page, at the time of data storage, used to input a two, 1 to afa, 1 is the bid in the page Numbers are shown in their respective input

The bid=trim (request form (" bid "))
Afa=trim (request form (afa))

Store below

The first
Set the rs=server. Createobject (" adodb. You ")
SQL="select * from aaa where the bid=" & amp; Bid&" "
Rs. The open (SQL), cn, 1, 3
There is no problem

The second
The set rs1=server. Createobject (" adodb. You ")
Sql1="select * from ZSJH where hid=" & amp; Afa&" "
Rs1. Open (sql1), cn, 1, 3

The refresh the page is wrong, it hasn't arrived to store step!
Then start exclusions
1, the second hid="& amp; Afa&" "To replace the first bid is hid=" & amp; Bid&" "No error
2, the second hid="& amp; Afa&" "Directly to digital hid=66" no error
3 to change the original digital type to type text all change to come over, all the way into hid like '% "& amp; Afa&" % 'still error
4, the first and second storage to separate different page, the page jumps location. The href='https://bbs.csdn.net/topics/aaa.asp? Hid="& amp; Afa&" '; </script>" An error here

At this point, exhausted, know the problem in "& amp; Afa&" Here, it and "& amp; Bid&" "Digital type, and also change under direct copy of the above statements, is an error, this" & amp; Afa&" Exactly wrong where, one day

Please the great god glad!

CodePudding user response:

Value is not single quotation marks

CodePudding user response:

To at least check after the afa is empty, is number one
If afa="Or" Not IsNumeric (afa) Then
An error
End the If

Determine the hid is digital type
Sql1="select * from ZSJH where hid=" & amp; Afa
Response. Write sql1
Perform output SQL, copy to the database environment see wrong yes
In addition & amp; Do not write, and the variable name attached to the middle empty one
  •  Tags:  
  • ASP
  • Related