another quickie...

Results 1 to 2 of 2

Thread: another quickie...

  1. #1
    Join Date
    Dec 1969

    Default another quickie...

    Sorry, my DBA has left me in a bit of a mess. This code is supposed to be live now and he has gone off somewhere :-(<BR><BR>set rsPreferredUserName = objconn.execute("proc_MemberExists " & preferredusername)<BR>if rspreferredusername.fields("MemberAccount") &#062; 0 then<BR> &#039; name already in use:<BR> response.Write "Preferred name already in use"<BR> <BR>else<BR><BR>is supposed to check that the membername required has not already been taken. The error it gets is:<BR><BR>Error converting data type nvarchar to int.<BR>/registration/create_new_member.asp, line 66<BR><BR>line 66 = set rsPreferredUserName = objconn.execute("proc_MemberExists " & preferredusername)<BR><BR>and the proc_MemberExists code is:<BR><BR>CREATE PROCEDURE dbo.proc_MemberExists<BR> @MemberID int<BR>AS<BR> BEGIN<BR> SELECT Count(*) AS MemberCount<BR> FROM Members<BR> WHERE MemberID = @MemberID<BR> END<BR>GO<BR><BR>to me it looks like the proc is asking for the wrong thing but I just dont know :-(

  2. #2
    Join Date
    Dec 1969

    Default Yeah, that's the wrong proc...

    ...or the wrong code. But it&#039;s useless for your purposes.<BR><BR>I&#039;d just dump the proc and code it as a SQL query from ASP.<BR><BR>&#060;%<BR>SQL = "SELECT MemberID FROM Members WHERE membername = &#039;" & preferredUserName & "&#039;"<BR>Set RS = objconn.Execute( SQL )<BR>If Not RS.EOF Then<BR> response.Write "Preferred name already in use"<BR> ...<BR>Else<BR> ....<BR>End If<BR>%&#062;<BR><BR>[Change the "membername" field there if that&#039;s not the name of the field in the DB.]<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