help me please?

Results 1 to 2 of 2

Thread: help me please?

  1. #1
    Join Date
    Dec 1969

    Default help me please?

    I am trying to verify users on a data base....the basic code is as follows:<BR><BR>&#060;script language=VBScript runat=Server><BR><BR>SUB VerifyUser<BR><BR>on error resume next<BR><BR>Dim Conn, RS, aupw, auname, connectstring, Cm, sSQL<BR><BR> auname=Request.Form("USERNAME")<BR> aupw=Request.Form("USERPW")<BR><BR>&#039 First let us create command and recordset objects<BR> Set Cm = Server.CreateObject("ADODB.Command")<BR> Set Rs = Server.CreateObject("ADODB.RecordSet")<BR><BR>&#03 9 Set the ActiveConnection property of command object to the <BR>&#039 ODBC source you will use<BR> Cm.ActiveConnection = "DSN=dsn1;uid=admin;pwd="<BR><BR>&#039 Now, create the SQL statement<BR> sSQL = "SELECT * FROM tUsers WHERE tUsers.userlogin = &#039" & auname & "&#039 AND tUsers.userpw = &#039" & aupw & "&#039"<BR> <BR>&#039 The CommandText property of Command object should contain <BR>&#039 this SQL statement<BR> Cm.CommandText = sSQL<BR><BR>&#039 Since we are using a SQL Statement in Command object, the CommandType<BR>&#039 Property should be adCmdText which has a value of 1<BR> Cm.CommandType = 1<BR><BR>&#039 Execute the command, and set the recordset object to the result<BR>&#039 of this execution. We obtain the resulting records in Rs object<BR> Set Rs = Cm.Execute<BR><BR>&#039 You might want to release the resources for command object, unless you want<BR>&#039 to use the same connection again in the later code<BR> Set Rs.ActiveConnection = Nothing<BR><BR>&#039 Use this RecordSet object to populate your HTML output stream<BR>Do While NOT Rs.EOF<BR>response.write tUsers.userlogin like auname<BR>response.write tuUsers.userpw like aupw<BR> <BR>Rs.MoveNext<BR>Loop<BR> <BR>END SUB<BR><BR> SUB Main<BR><BR> VerifyUser <BR> END SUB<BR><BR> Main<BR>&#060;/script><BR><BR>----what I am trying to do is if the userlogin and the userpassword match the database from the entry page then go to the appropriate page...if not then respond with invalid user try again.<BR>Can some one please help?<BR>p.s. this is on an access database.<BR><BR>thanks, Ray<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: help me please?

    Check out for a good discussion and example of how to do this! :) Happy Programming!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts