I have it:
sqlString = "SELECT * FROM employees WHERE lastname = '" & last_name & "'" Set cmd = Server.CreateObject("ADODB.Command") Set cmd.ActiveConnection = dbConn cmd.CommandText = sqlString cmd.Prepared = True Set recs = cmd.Execute
The problem is that a prepared statement command precedes the dynamic part of sqlString . I do not think that what I have above protects me.
Is there no need to fix this sqlString before I make a prepared statement? Reading this made me think that: How are prepared statements protected against SQL injection attacks? :
"Although in the case of prepared statements we do not modify our program, it remains intact. This is the point.
First we send the program to the server
$db->prepare("SELECT * FROM users where id=?");
where the data is replaced by some variable called "placeholder" and then we send the data separately:
$db->execute($data);
therefore, he cannot change our program and do any harm. Pretty simple - right? "
But I do not know how to make my request correctly. I also don't know how it got from prepare to $data . Hope for guidance. Thanks.
source share