Inputing data into a recordset

Results 1 to 2 of 2

Thread: Inputing data into a recordset

  1. #1
    Join Date
    Dec 1969

    Default Inputing data into a recordset

    I want to know how to input data into a field is a record set. If you can help, please e-mail me at, thanks!

  2. #2
    Join Date
    Dec 1969

    Default RE: Inputing data into a recordset

    CREATE PROCEDURE InsertName<BR>(<BR> @username varchar(25), <BR> @userpassword varchar(25)<BR>)<BR>AS<BR>IF EXISTS(SELECT &#039;True&#039; FROM MyTable WHERE username = @username)<BR>BEGIN<BR> --This means it exists, return it to ASP and tell us<BR> SELECT &#039;This record already exists!&#039;<BR>END<BR>ELSE<BR>BEGIN<BR> --This means the record isn&#039;t in there already, let&#039;s go ahead and add it<BR> SELECT &#039;Record Added&#039;<BR> INSERT into MyTable(username, userpassword) VALUES(@username, @userpassword)<BR>END<BR><BR>&#060;%<BR> Dim db, rs<BR> Set db = Server.CreateObject("ADODB.Connection")<BR> db.Open myTest &#039;use your connection here<BR> &#039;And call our Stored procedure passing the username and userpassword<BR> Set rs = db.Execute("InsertName &#039;" & _<BR> Request.Form("username") & "&#039;,&#039;" & _<BR> Request.Form("password") & "&#039;")<BR><BR> &#039;Now let&#039;s check what happened<BR> If rs(0) = "This record already exists!" Then<BR> &#039;We can either redirect back to the original page and tell<BR> &#039;the user to try again or write something out to this page<BR> Else<BR> Response.Write "Your user name and password has been accepted."<BR> End If<BR>%&#062;<BR> <BR>

Posting Permissions

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