ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 1st, 2000, 06:25 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
Parametrized query

<i><b>Originally posted by : BalaKrishnan (ramaswamy.balakrishnan@dupontpharma.com)</b></i><br /><br />I have an Access database and I want to get the user id and using the following code; <br />but it does not work. I need some help.<br /><br /><%<br />Dim name<br />Dim password<br />name=Request.Form("UserName")<br />password=Request.Form("Password1")<br /><br />Set cn = Server.CreateObject("ADODB.Connection")<br />set rs = Server.CreateObject("ADODB.Recordset")<br />strconn="DSN=caco; UID=; Password=;"<br /><br />strSQL="SELECT USERtbl.UserName, USERtbl.Password," <br />strSQL=strSQL & "GROUPtbl.GroupID FROM USERtbl, USER_GROUP_LISTtbl,"<br />strSQL=strSQL & "GROUPtbl WHERE USERtbl.UserID = USER_GROUP_LISTtbl.UserID "<br />strSQL=strSQL & "AND USER_GROUP_LISTtbl.GroupID = GROUPtbl.GroupID "<br />strSQL=strSQL & "AND USERtbl.UserName= '" & Request.Form("UserName") & "' "<br />strSQL=strSQL & "AND USERtbl.Password= '" & Request.Form("Password1") & "' "<br /><br />rs.Open strSQL, strconn,2,2<br />Response.Write Request.Form("Password1")<br />Do while not rs.EOF<br />Response.Write rs("UserName") & "<BR>"<br />Response.Write rs("GroupID") & "<BR>"<br />rs.MoveNext<br />Loop<br /><br />rs.Close<br />cn.Close<br />%><br /><br />

Reply With Quote
  #2  
Old February 3rd, 2000, 12:32 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
<i><b>Originally posted by : jh</b></i><br />here is some sample code I found<br /><br />Here is a sample for a parameterized stored procedure in MS Access. The SQL in Access is: PARAMETERS [inid] Text; SELECT ... and on. <br /><br />And the source is: <br /><br /><br /><%@ Language=VBScript %><br /><%<br /> Dim cnn1<br /> Dim cmdNyttSvarID<br /> Dim prmNyttSvarID<br /> Dim rstNyttSvarID<br /> Dim strID<br /> Dim strCnn<br /> Dim strSize<br /> Dim i<br /> Dim tmpFields<br /> Dim strName<br /> Dim strTable<br /> <br /> ' Open connection.<br /> Set cnn1 = Server.CreateObject ("ADODB.Connection")<br /> strCnn = "DSN=agenda21"<br /> cnn1.Open strCnn<br /> cnn1.CursorLocation = adUseClient<br /> <br /> ' Open command object with one parameter.<br /> Set cmdNyttSvarID = Server.CreateObject ("ADODB.Command")<br /> cmdNyttSvarID.CommandText = "nyttsvarid"<br /> cmdNyttSvarID.CommandType = adCmdStoredProc<br /> <br /> ' Get parameter value and append parameter.<br /> ' The value for the one parameter in this example<br /> strID = "00001"<br /> strSize = Len(strID)<br /> <br /> ' Parametername<br /> strName = "inid"<br /> <br /> Set prmNyttSvarID = cmdNyttSvarID.CreateParameter(strName, adVarChar, adParamInput,strSize,strID)<br /> cmdNyttSvarID.Parameters.Append prmNyttSvarID<br /> prmNyttSvarID.Value = strID<br /> <br /> ' Create recordset by executing the command.<br /> Set cmdNyttSvarID.ActiveConnection = cnn1<br /> Set rstNyttSvarID = cmdNyttSvarID.Execute<br /> i = 1<br /> <br /> ' Dump the returned recordset to the client<br /> 'set rstNyttSvarID = Server.CreateObject ("ADODB.RECORDSET")<br /> 'set tmpField = rstNyttSvarID.Fields.Item (1).Value <br /> <br /> Do While Not rstNyttSvarID.EOF<br /> Response.Write ("<BR>")<br /> <br /> For Each tmpField In rstNyttSvarID.Fields<br /> Response.Write (tmpField.Name & ":" & tmpField.Value & ",")<br /> Next<br /> <br /> rstNyttSvarID.MoveNext<br /> Loop<br /> <br /> rstNyttSvarID.Close<br /> cnn1.Close<br />%><br /><br /><br /><br /><br />------------<br />BalaKrishnan at 2/1/00 3:25:55 PM<br /><br /><br />I have an Access database and I want to get the user id and using the following code; <br />but it does not work. I need some help.<br /><br /><%<br />Dim name<br />Dim password<br />name=Request.Form("UserName")<br />password=Request.Form("Password1")<br /><br />Set cn = Server.CreateObject("ADODB.Connection")<br />set rs = Server.CreateObject("ADODB.Recordset")<br />strconn="DSN=caco; UID=; Password=;"<br /><br />strSQL="SELECT USERtbl.UserName, USERtbl.Password," <br />strSQL=strSQL & "GROUPtbl.GroupID FROM USERtbl, USER_GROUP_LISTtbl,"<br />strSQL=strSQL & "GROUPtbl WHERE USERtbl.UserID = USER_GROUP_LISTtbl.UserID "<br />strSQL=strSQL & "AND USER_GROUP_LISTtbl.GroupID = GROUPtbl.GroupID "<br />strSQL=strSQL & "AND USERtbl.UserName= '" & Request.Form("UserName") & "' "<br />strSQL=strSQL & "AND USERtbl.Password= '" & Request.Form("Password1") & "' "<br /><br />rs.Open strSQL, strconn,2,2<br />Response.Write Request.Form("Password1")<br />Do while not rs.EOF<br />Response.Write rs("UserName") & "<BR>"<br />Response.Write rs("GroupID") & "<BR>"<br />rs.MoveNext<br />Loop<br /><br />rs.Close<br />cn.Close<br />%><br /><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > Parametrized query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek