Stored Procedure

Results 1 to 2 of 2

Thread: Stored Procedure

  1. #1
    Join Date
    Dec 1969

    Default Stored Procedure

    Why can&#039t I AddNew record?<BR>I have the following Stored Procedure and the code that calls it:<BR><BR>Alter Procedure SP_CME_Signup<BR><BR>@availnumber int<BR><BR>AS<BR><BR>IF EXISTS(SELECT &#039True&#039 FROM tblInstitutionMembers WHERE InstitutionCode = 0009 And MemberCode = @availnumber)<BR>BEGIN<BR>--This means the record exists already<BR>SELECT &#039I exist&#039<BR>END<BR>ELSE<BR>BEGIN<BR>--This means the record isn&#039t in there<BR>SELECT &#039No exist&#039<BR>END<BR><BR>&#039 Calling Code:<BR><BR>availnumber = 1000<BR><BR>sSql = "SP_CME_Signup " & availnumber<BR>Set rs = DbConn.Execute(sSQL)<BR><BR>If rs(0) = "I exist" Then<BR>&#039do something<BR>availnumber = availnumber +1<BR>Else<BR>&#039do something else<BR> rs.AddNew<BR> rs("InstitutionCode") = pname<BR> rs("MemberCode") = availnumber<BR> rs("IsPhysician") = iname<BR> rs("LastName") = lname<BR> rs("FirstName") = fname<BR> rs("MiddleInitial") = mname<BR> If iname &#060;&#062; "N" Then<BR> rs("IsPhysician") = 1<BR> Else<BR> rs("IsPhysician") = 0<BR> End If<BR> rs("Email") = ename<BR> rs.Update<BR> rs.Close<BR>End If<BR><BR><BR>&#039 Error Message:<BR><BR>ADODB.Recordset error &#039 800a0cb3&#039 <BR><BR>Object or provider is not capable of performing requested operation. <BR><BR>/iame-online-entry.asp, line 36 <BR>

  2. #2
    Steve Cimino Guest

    Default RE: Stored Procedure

    I don&#039t think you can add records with the way you&#039ve created the RS object... I&#039m not sure, because I never update records in that way.<BR><BR>Either<BR>1) Add another INSERT statement, and call the db.execute again<BR><BR>2) Write all your variables to the sp the first time, and update them in your SP when the else clause fires.

Posting Permissions

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