473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

value is not showing under recordset.eof using parameterized query in vbscript

I am creating one login validation page for my classic asp site(vbscript). as i want prevent my page from sql injection, i used parametrized queries in my page but i am unable to retrieve value after writing if "not recordset.eof" line. value is not passing. please help me to solve this issue. my code is below given.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim Objrs, objConn, objCmd, str
  3.  
  4. Set objConn = Server.CreateObject("ADODB.Connection")
  5. Set objCmd  = Server.CreateObject("ADODB.Command")
  6. Set Objrs   = Server.CreateObject("ADODB.Recordset")
  7.  
  8. objConn.open MM_connDUdirectory_STRING '(already created)
  9.  
  10. Set objCmd.ActiveConnection = objConn
  11.  
  12. str = "SELECT * FROM admin WHERE Ausr=? AND Apwd=?"
  13.  
  14. objCmd.CommandText = str
  15. objCmd.CommandType = adCmdText
  16.  
  17. dim objParam1, objParam2
  18. Set objParam1 = objCmd.CreateParameter("param1", adVarChar, adParamInput, len(StrUserName), "")
  19. objCmd.Parameters.Append objParam1
  20. objCmd.Parameters("param1") = StrUserName
  21.  
  22. Set objParam2 = objCmd.CreateParameter("param2", adVarChar, adParamInput, len(StrPassword), "")
  23. objCmd.Parameters.Append objParam2
  24. objCmd.Parameters("param2") = StrPassword
  25. set objRS = objCmd.execute
  26.  
  27.  
  28. if objRS.EOF <> True and objRS.BOF <> True then
  29. if Objrs("Ausr") = objCmd.Parameters("param1") then
  30. response.Write(Objrs("Ausr"))
  31. 'response.Write should show username but its showing blank
  32. end if
  33. end if
  34. %>
  35.  
Aug 1 '14 #1
0 1179

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: deko | last post by:
I'm trying to open a Recordset based on a parameterized query. I'm kind of new to parameterized queries, so I'm sure I'm missing something simple. Set qdfs = db.QueryDefs Set qdf =...
1
by: Jorell | last post by:
Hey everyone, I am currently using Microsofts DataAccess Application block ( SQLHelper ) and what I want to do is use a parameterized query instead of just SQL. I can not use stored procedures,...
7
by: skeddy | last post by:
In a nutshell, I'm trying to dynamically create a select box with ResultSet code in vbscript and then need to be able to access the value of that select box later with a Save button. I've got...
8
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: ...
0
by: BenCoo | last post by:
Hello colleagues, I have a ObjectDataSource wich is linked to a SQL Server 2005 database I a gridview I have data and on each row a "Edit button" wich wil show the selected record in editmode....
1
by: TF | last post by:
This group came through for me last time so here we go again. My page shows paint colors, brand name, product code, etc in a gridview with the background matching the paint color. Several links on...
9
ADezii
by: ADezii | last post by:
One question which pops up frequently here at TheScripts is: 'How do I retrieve data from a Recordset once I've created it?' One very efficient, and not that often used approach, is the GetRows()...
3
by: xlar54 | last post by:
Is there a way to see the exact SQL being generated from a parameterized query? I am using this technique but am getting some strange SQL errors during execution and I would like to see the final...
2
by: mcalex | last post by:
Hi, I'm having trouble trying to populate a list box with data from a parameterized query. If I set the rowsource property to the query name, when the form opens I get the parameter values dialog,...
1
by: AnagJohari | last post by:
I want to know the meaning of @ symbol In parameterized query. apart from this if i write an query like this Delete * From Client Where Id=@Id Can u explain the work Of @Id? its just like a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.