• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

when i load my page i get this error and i don't know what it's from:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Procedure 'DM_SP_SelectCountEntries' expects parameter '@varRelationship', which was not supplied.

/toc.asp, line 347


this is the code for the page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>TEEN WRITING NET</title>
<meta http-equiv="Content-Type" content="text/css; charset=iso-8859-1">
<meta name="description" content="The newest teen writing site and contest.">
<meta name="keywords" content="keyword, keyword, keyword, keyword, keyword, keyword, keyword phrase, keyword phrase, keyword phrase, keyword phrase">
<meta name="copyright" content="2002 Teenwriting.net.  All rights reserved.  Duplication of any content on this site is prohibited.">
<meta name="design by" content="Teenwriting.net">
<meta name="robots" content="all">
<meta name="revisit-after" content="7 days">
<meta name="distribution" content="global">
<meta name="document-classification" content="General">
<meta name="rating" content="general">
<meta name="language" content="EN">

<script language="JavaScript">
function doClock(){
  var t=new Date(),a=doClock.arguments,str="",i,a1,lang="1";
  var month=new Array('January','Jan', 'February','Feb', 'March','Mar', 'April','Apr', 'May','May', 'June','Jun', 'July','Jul', 'August','Aug', 'September','Sep', 'October','Oct', 'November','Nov', 'December','Dec');
  var tday= new Array('Sunday','Sun','Monday','Mon', 'Tuesday','Tue', 'Wednesday','Wed','Thursday','Thr','Friday','Fri','Saturday','Sat');
  for(i=0;i<a.length;i++) {a1=a[i].charAt(1);switch (a[i].charAt(0)) {
  case "M":if  ((Number(a1)==3) && ((t.getMonth()+1)<10)) str+="0";
  str+=(Number(a1)>1)?t.getMonth()+1:month[t.getMonth()*2+Number(a1)];break;
  case "D": if ((Number(a1)==1) && (t.getDate()<10)) str+="0";str+=t.getDate();break;
  case "Y": str+=(a1=='0')?t.getFullYear():t.getFullYear().toString().substring(2);break;
  case "W":str+=tday[t.getDay()*2+Number(a1)];break; default: str+=unescape(a[i]);}}return str;
}
</script>


<link rel="stylesheet" href="http://www.teenwriting.net/btstyle19.css" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><FONT face=Verdana>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#a4a09f">
  <tr valign="center" align="middle">
    <td colspan="6" class="bthead" height="2">
      <div align="left"><A href="#"><FONT face=Verdana>
        <IMG height=90 alt="REPLACE WITH MEANINGFUL IMAGE DESCRIPTION" src  ="http://teenwriting.net/header.jpg" width=750 border=0 ></FONT></A></div>
    </td>
  </tr>
  <tr valign="center" align="middle">
    <td width="16%" class="btnav" height="20">
      <div align="center"><a href="http://poetry.teenwriting.net"><FONT
      face=Verdana>Poetry</FONT></a></div>
    </td>
    <td class="btnav" height="20" width="16%">
      <div align="center"><a href="http://songs.teenwriting.net"><FONT
      face=Verdana>Songs</FONT></a></div>
    </td>
    <td class="btnav" height="20" width="15%">
      <div align="center"><A href="http://stories.teenwriting.net"><FONT face=Verdana>Stories</FONT></A></div>
    </td>
    <td class="btnav" height="20" width="17%">
      <div align="center"><A href="http://essay.teenwriting.net"><FONT face=Verdana>Essay</FONT></A></div>
    </td>
    <td class="btnav" height="20" width="17%">
      <div align="center"><A href="http://fiction.teenwriting.net"><FONT face=Verdana>Fiction</FONT></A></div>
    </td>
    <td width="19%" class="btnav" height="20">
      <div align="center"><A href="http://fanfic.teenwriting.net"><FONT
  face=Verdana>Fan Fiction</FONT></A></div>
    </td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <TBODY>
  <tr>
    <td valign="top" height="514">
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr>
          <td class="btnavbk" height="98"><FONT
            face=Verdana>&nbsp;</FONT></td>
          <td class="btnavbk" valign="center" height="98">
            <table width="99%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000" align="center">
              <tr>
                <td height="2" bgcolor="#a4a09f">
                  <div align="center"> <b><FONT face=Verdana>Current
                  News</FONT> </b></div>
                </td>
              </tr>
              <tr>
                <td class="btnavbk" valign="top" height="67">
                  <table width="100%" border="0" cellspacing="0" cellpadding="8">
                    <tr>
                      <td bgcolor="#ffffff" valign="top" height="54">
                        <p><FONT face=Verdana>Hi every one! Welcome to the new spot for teen writngs. We are still currently
                                    hard at work trying ot get this awesome and fun site up and running! Check back often cause we will
                                    be offering tons of cool things for everyone to do.  You'll be able to post your work and read and
                                    critique other teens writings and enjoy contest as well! If you have any ideas or suggestions please
                                    feel free to email us at: <A href="mailto:suggestions@teenwriting.net">suggestions</A>! Thanks again
                                    for looking. Please check back soon!
                    </FONT>  
 </p>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
     
        <table width="100%" border="0" cellspacing="0" cellpadding="8">
        <TBODY>
        <tr>
          <td valign="top" class="btnavbk" width="20%" height="433">
            <p align="center"><FONT face=Verdana><FONT>
            <TABLE borderColor=#000000 cellSpacing=0 cellPadding=8 width="100%"
            border=1>          <p align="center"><FONT face=Verdana><FONT><IMG height=1 src="images/clear.gif" width=160><br>
              <b>
              <script language="JavaScript">
   document.write(doClock("M0","%20","D0",",%20","Y0"));
</script>
              </b></FONT>
<!--#include file = "menu.xhtml"-->
            <br>
            <table width="100%" border="1" cellspacing="0" cellpadding="8" bordercolor="#000000">
              <tr>
                <td bgcolor="#ffffff" valign="top" height="254">
                  <table width="100%" border="0" cellspacing="0" cellpadding="1">
                    <tr>
                      <td class="btnavbk">
                        <div align="center"><FONT
                        face=Verdana>Coming Events </FONT>  </div>
                      </td>
                    </tr>
                    <tr>
                      <td><FONT face=Verdana>We will be up and running very shortly now! We are hard at work
                                and working with local companies to bring you some really new and cool things! If you have any
                                questions or comments please <A href="mailto:suggestions@teenwriting.net">email us</A>!
                  </FONT>  
                   
                               </td>
                    </tr>
                  </table>
                 
                </td>
              </tr>
            </table>
            <p><FONT face=Verdana>
            <TABLE borderColor=#000000 cellSpacing=0 cellPadding=8 width="100%"
            border=1>
             
              <TR>
                <TD vAlign=top width=75 bgColor=#ffffff height=84>
                  <P><A href="#"><FONT
                  face=Verdana>Your Link</FONT> </A><BR><A href="#"><FONT
                  face=Verdana>Your Link</FONT> </A><BR><A href="#"><FONT
                  face=Verdana>Your Link</FONT> </A><BR><A href="#"><FONT
                  face=Verdana>Your Link</FONT> </A><BR><A href="#"><FONT
                  face=Verdana>Your Link</FONT> </A><BR></P></TD>
                <TD vAlign=top width=75 bgColor=#ffffff height=84><A
                  href="#"><FONT
                  face=Verdana>Your Link</FONT> </A><BR><A href="#"><FONT
                  face=Verdana>Your Link</FONT> </A><BR><A href="#"><FONT
                  face=Verdana>Your Link</FONT> </A><BR><A href="#"><FONT
                  face=Verdana>Your Link</FONT> </A><BR><A href="#"><FONT
                  face=Verdana>Your Link</FONT>
            </A><BR></TD></TR></TABLE></FONT></p>
          </td>
          <td valign="top" width="64%" height="433">
            <p><br><FONT
            face=Verdana>
          <p>
             <!--#include file = "header.xhtml"--><br>
            <%

Dim varPageName
Dim varAuthorID
Dim varLoadTOC
Dim varAlias,varDiaryType,varDiaryTitle,varDiaryDescription
varDiaryDescription = Empty

varPageName = "TOC"
varAuthorID = Request("AuthorAliasID")
varLoadTOC = True
%>
<!--#include file = "security.inc"-->
<!--#include file = "ensureconnection.inc"-->
<!--#include file = "checkstatus.inc"-->
<!--#include file = "preferences.inc"-->
<!--#include file = "stringreplace.inc"-->
<%

Set comm = Server.CreateObject("ADODB.Command")
Set rs = Server.CreateObject("ADODB.Recordset")
comm.ActiveConnection = "DSN=members_sql;UID=members;PWD=ecfcod3;"
comm.CommandType = 4
comm.CommandText = "DM_SP_SelectDiaryDescription"
comm.Execute, Request("AuthorAliasID")
rs.Open comm
If ((rs.EOF = False) And (rs.BOF = False)) Then
 varAlias = rs.Fields("Alias")
 varDiaryType = rs.Fields("DiaryType")
 varDiaryTitle = rs.Fields("DiaryTitle")
 varDiaryDescription = Replace(("" & rs.Fields("DiaryDescription") & ""),vbcrlf,"<BR>" & vbcrlf)
 If (Session("Javascript") = "None") Then
  varDiaryDescription = ReplaceSens(varDiaryDescription,"<script","<xxxxxx",1)
  varDiaryDescription = ReplaceSens(varDiaryDescription,"language=","xxxxxxxxx",1)
 End If
 If (Session("AllowMusic") = "None") Then
  varDiaryDescription = ReplaceSens(varDiaryDescription,"<bgsound","<xxxxxxx",1)
  varDiaryDescription = ReplaceSens(varDiaryDescription,"<embed","<xxxxx",1)
 End If
 If (Session("BackgroundImages") = "None") Then
  varDiaryDescription = ReplaceSens(varDiaryDescription,"background:","xxxxxxxxxx:",1)
  varDiaryDescription = ReplaceSens(varDiaryDescription,"background=","xxxxxxxxxx=",1)
  varDiaryDescription = ReplaceSens(varDiaryDescription,"background-","xxxxxxxxxx-",1)
 End If
 If (Session("ImagesTOC") = "None") Then
  varDiaryDescription = ReplaceSens(varDiaryDescription,"<img ","<xxx",1)
 ElseIf ((Session("ImagesTOC") = "Friends") And (varMyFriend <> "Friend")) Then
  varDiaryDescription = ReplaceSens(varDiaryDescription,"<img","<xxx",1)      
 End If
End If
rs.Close
Set rs = Nothing
Set comm = Nothing
%><html>
 <head>
   <!--#include file = "stylesheet.inc"-->
  <TITLE>
   Welcome to <%=varAlias%>'s Diary<%If (Session("AuthorAlias") <> "") Then Response.Write(", " & Session("AuthorAlias"))%>
  </TITLE>
<%  
If (varStatus = "Author") Then
 Response.Write("<SCRIPT LANGUAGE=" & """" & "JavaScript" & """" & ">" & vbcrlf)
 Response.Write(" <!--" & vbcrlf)
 Response.Write("  function confirm_delete(){" & vbcrlf)
 Response.Write("   var password = prompt(" & """" & "To delete your diary, please enter your password and click OK" & """" & "," & """" & """" & ");" & vbcrlf)
 Response.Write("   if (password != " & """" & """" & " && password != null){" & vbcrlf)
 Response.Write("    document.write(" & """" & "<FORM NAME=DeleteDiary METHOD=Post ACTION=deletediary.asp>" & """" & ");" & vbcrlf)
 Response.Write("    document.write(" & """" & "<INPUT NAME=Password TYPE=Hidden MAXLENGTH=10 VALUE=" & """" & " + password + " & """" & ">" & """" & ");" & vbcrlf)
 Response.Write("    document.write(" & """" & "</FORM>" & """" & ")" & vbcrlf)
 Response.Write("    document.DeleteDiary.submit();" & vbcrlf)
 Response.Write("   }" & vbcrlf)
 Response.Write("  }" & vbcrlf)
 Response.Write(" -->" & vbcrlf)
 Response.Write("</SCRIPT>" & vbcrlf)
End If
%>  
 

    <TD VALIGN="Top" ALIGN="Center" COLSPAN="1" NAME="RightMenu" ID="RightMenu" WIDTH="25%" CLASS="MenuRight">
     <TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="1" >
<%
If (varIsIgnore = True) Then
 Response.Write("<TR><TD>")
 Response.Write("Sorry, but " & varAlias & " is ignoring you")
 Response.Write("</TD></TR>")
 varLoadTOC = False
ElseIf (varMyIgnore = True) Then
 Response.Write("<TR><TD>")
 Response.Write("You are ignoring " & varAlias)
 Response.Write("</TD></TR>")
 varLoadTOC = False
ElseIf ((varDiaryType = "Private") And (varStatus <> "Author")) Then
 Response.Write("<TR><TD>")
 Response.Write("Sorry, only " & varAlias & " can read this diary")
 Response.Write("</TD></TR>")
 varLoadTOC = False
ElseIf ((varDiaryType = "Friends") And (varStatus <> "Friend") And (varStatus <> "Author")) Then
 Response.Write("<TR><TD>")
 Response.Write("Sorry, only people on " & varAlias & "'s friends list can read this diary")
 Response.Write("</TD></TR>")
 varLoadTOC = False
ElseIf ((varDiaryType = "Signed") And (varStatus = "Unsigned")) Then
 Response.Write("<TR><TD>")
 Response.Write("Sorry, but " & varAlias & " only allows people who are logged in to read this diary")
 Response.Write("</TD></TR>")
 varLoadTOC = False
ElseIf (varStatus = "Invisible") Then
 If (Request.ServerVariables("HTTP_REFERER") <> "") Then
  Response.Redirect(Request.ServerVariables("HTTP_REFERER"))
 Else
  Response.Redirect("/")
 End If
End If

If (varLoadTOC = True) Then
 ReDim params(2)
 params(1) = Request("AuthorAliasID")
 params(0) = int(Session("AuthorAliasID"))
 params(2) = int(Request("Limit"))
 Set comm = Server.CreateObject("ADODB.Command")
 Set rs = Server.CreateObject("ADODB.Recordset")
 comm.ActiveConnection = "DSN=members_sql;UID=members;PWD=ecfcod3;"
 comm.CommandType = 4
 comm.CommandText = "DM_SP_SelectTOC"
 comm.Execute , params
 Set params(2) = Nothing
 Set params(1) = Nothing
 Set params(0) = Nothing
 rs.Open comm
 If ((rs.EOF = False) And (rs.BOF = False)) Then
  Do While Not rs.EOF
  Response.Write("<TR><TD>")
  Response.Write("<SPAN CLASS=" & """" & "TOC" & """" & ">")
  Response.Write(" <SMALL>(")
  Response.Write(rs.Fields("Number"))
  Response.Write(")</SMALL>")
  Response.Write("</TD><TD>")
  Response.Write("<A HREF=" & """" & "entry.asp?EntryID=")
  Response.Write(rs.Fields("EntryID"))
  Response.Write("""" & ">")
  If (rs.Fields("EntryType") = "Private") Then
   Response.Write("<B>P</B> - ")
  ElseIf (rs.Fields("EntryType") = "Friends") Then
   Response.Write("<B>F</B> - ")
  End If
  If (rs.Fields("Title") <> "") Then
   Response.Write(rs.Fields("Title"))
  Else
   Response.Write(rs.Fields("EntryID"))
  End If
  Response.Write("</A>")
  Response.Write("</TD><TD>")
  Response.Write("<SPAN CLASS=" & """" & "TOC" & """" & ">")
  Response.Write(" <SMALL>")
  Response.Write(FormatDateTime(rs.Fields("AuthorDateCreated"),2))
  Response.Write("</SMALL>")
  Response.Write("<BR>")
  Response.Write("</TD></TR>")
  rs.MoveNext
  Loop
 End If
 rs.Close
 Set rs = Nothing
 Set comm = Nothing
 
 Response.Write("<TR><TD COLSPAN=" & """" & "3" & """" & ">")
 
 Set comm = Server.CreateObject("ADODB.Command")
 Set rs = Server.CreateObject("ADODB.Recordset")
 Dim intIndex
 comm.ActiveConnection = "DSN=members_sql;UID=members;PWD=ecfcod3;"
 comm.CommandType = 4
 comm.CommandText = "DM_SP_SelectCountEntries"
 comm.Parameters.Append comm.CreateParameter ("@varAliasID",3,1,3,Request("AuthorAliasID"))
 comm.Parameters.Append comm.CreateParameter ("@varRelationship",200,1,8,varStatus)
 comm.Parameters.Append comm.CreateParameter ("@NumberOfEntries",3,4,3,Empty)
 comm.Parameters.Append comm.CreateParameter ("@NumberOfTables",3,4,3,Empty)
 comm.Parameters.Append comm.CreateParameter ("@NumberOfLeftovers",3,4,3,Empty)
 comm.Execute

 If (comm.Parameters("@NumberOfTables") > 0) Then
  Response.Write("<BR>")
  If (Request("Limit") <> "") Then
   Response.Write("<A HREF=" & """" & "toc.asp?AuthorAliasID=" & Request("AuthorAliasID") & """" & ">")
   Response.Write("Most Recent Entries")
   Response.Write("</A>")
  End If
 
  For intIndex = 1 to comm.Parameters("@NumberOfTables")-1
   Response.Write("<BR>")
   If (int(Request("Limit")) <> comm.Parameters("@NumberOfEntries") - (intIndex * 50)) Then
    Response.Write("<A HREF=" & """" & "toc.asp?AuthorAliasID=" & Request("AuthorAliasID"))
    Response.Write("&" & "Limit=" & (comm.Parameters("@NumberOfEntries") - (intIndex * 50)) & """")
    Response.Write(">Entries " & ((comm.Parameters("@NumberOfEntries") - ((intIndex + 1) * 50)) + 1) & " to ")
    Response.Write((comm.Parameters("@NumberOfEntries") - (intIndex * 50)))
    Response.Write("</A>")
   Else
    Response.Write("Entries " & ((comm.Parameters("@NumberOfEntries") - ((intIndex + 1) * 50)) + 1) & " to ")
    Response.Write((comm.Parameters("@NumberOfEntries") - (intIndex * 50)))  
   End If
  Next
 
  Response.Write("<BR>")
  Response.Write("<A HREF=" & """" & "toc.asp?AuthorAliasID=" & Request("AuthorAliasID"))
  Response.Write("&" & "Limit=" & comm.Parameters("@NumberOfLeftovers") & """")
  Response.Write(">Entries 1 to " & comm.Parameters("@NumberOfLeftovers"))
 End If
 Set rs = Nothing
 Set comm = Nothing
 
 Response.Write("</TD></TR>")

End If
%>
     </TABLE>
    </TD>
   </TR>

             </p>
               
            </p>  </FONT></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
 
  <tr>
    <td class="btfoot">
      <div align="center"><FONT face=Verdana>© 2002 Teen Writing Net. All rights reserved. Page design by </FONT>  
                   <!--#include file = "footer.xhtml"-->  <br>
                           
          <a href="http://www.teenwriting.net" target="_blank"><FONT
      face=Verdana>TEEN WRITING NET</FONT> </FONT></a><FONT
      face=Verdana>.</FONT></FONT></div></td></tr></table></FONT>
</body>
</html>


thanks alot!
0
mtrxpoet
Asked:
mtrxpoet
  • 6
  • 5
  • 3
  • +1
1 Solution
 
gladxmlCommented:
mtrxpoet,


try to check out the link might help...

http://www.adopenstatic.com/faq/80040e14.asp
0
 
mtrxpoetAuthor Commented:
alright i've narrowed it down to this:

Scenario 5 - Mismatched CommandTypeEnum value
When opening a recordset you can pass an optional CommandTypeEnum value (eg adCmdText, adCmdTable or adCmdStoredProc) to ADO to help it identify the source of your data. If you choose to specify a database table as your data source, but pass the CommandTypeEnum value for adCmdText, then you will receive the following error message. Either change the CommandTypeEnum to adCmdTable or adCmdTableDirect -or- use an SQL query as the source of your recordset.

Microsoft JET Database Engine (0x80040E14)
Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.


but i still don't know how i would go about fixxing it. i don't see where it would be
0
 
gladxmlCommented:
mtrxpoet,

I think you setting two comm object at the same time... Try to remarks this lines and check the result...

Set comm = Server.CreateObject("ADODB.Command")
Set rs = Server.CreateObject("ADODB.Recordset")
Dim intIndex
comm.ActiveConnection = "DSN=members_sql;UID=members;PWD=ecfcod3;"
comm.CommandType = 4
comm.CommandText = "DM_SP_SelectCountEntries"
comm.Parameters.Append comm.CreateParameter ("@varAliasID",3,1,3,Request("AuthorAliasID"))
comm.Parameters.Append comm.CreateParameter ("@varRelationship",200,1,8,varStatus)
comm.Parameters.Append comm.CreateParameter ("@NumberOfEntries",3,4,3,Empty)
comm.Parameters.Append comm.CreateParameter ("@NumberOfTables",3,4,3,Empty)
comm.Parameters.Append comm.CreateParameter ("@NumberOfLeftovers",3,4,3,Empty)
comm.Execute

Or you can try this

Set comm1 = Server.CreateObject("ADODB.Command")
Set rs1 = Server.CreateObject("ADODB.Recordset")
Dim intIndex
comm1.ActiveConnection = "DSN=members_sql;UID=members;PWD=ecfcod3;"
comm1.CommandType = 4
comm1.CommandText = "DM_SP_SelectCountEntries"
...
comm1.Execute
 
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
FractureCommented:
Your not setting varStatus anywhere that could be the problem.

Fracture
0
 
mtrxpoetAuthor Commented:
how do u set var status?
0
 
FractureCommented:
?? I assume this is your code as well and your setting it here but not in the code above

http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20418314.html
0
 
gladxmlCommented:
mtrxpoet,

just remarks the line below and check the output...

'comm.Parameters.Append comm.CreateParameter
("@varRelationship",200,1,8,varStatus)

Also this is a good example of what you are trying to do...

http://www.aspfree.com/asp/commandobject.asp

0
 
mtrxpoetAuthor Commented:
thats my partner. he's been working on the other part of the site and doing work while i'm at sea (u.s. navy) so of course it's been several months since i've done any of this. but now he's gone for training in the marines so he'll be gone for a few months.  i've tried using the examples the people have givin me but still nothing. and i just can't figure out what i'm doing wrong!
0
 
FractureCommented:
In this line of code

'comm.Parameters.Append comm.CreateParameter
("@varRelationship",200,1,8,varStatus)


you are not passing the Db anything because no where on the page has varStatus been set.

Under this line(about340): Dim intIndex
Write this:

Dim varStatus
varStatus="Author"

Does it still give same error?


0
 
mtrxpoetAuthor Commented:
ok fracture that worked so far. now thou i get an error that is the same error number but it said there are Too many arguments were supplied for procedure DM_SP_SelectCountEntries
0
 
FractureCommented:
Can you post DM_SP_SelectCountEntries ?
0
 
mtrxpoetAuthor Commented:
this is my dp_sp_selectcountentries



CREATE PROCEDURE DM_SP_SelectCountEntries @varAliasID int, @varRelationship varchar(8), @outNumberOfEntries int OUTPUT, @outNumberOfTables int OUTPUT, @outNumberOfLeftovers int OUTPUT AS

IF @varRelationship = 'Author'
 SELECT @outNumberOfEntries = COUNT(*) FROM TableEntries WHERE AliasID = @varAliasID

IF @varRelationship = 'Friend'
 SELECT @outNumberOfEntries = COUNT(*) FROM TableEntries WHERE AliasID = @varAliasID AND EntryType <> 'Private'

IF @varRelationship = 'Signed'
 SELECT @outNumberOfEntries = COUNT(*) FROM TableEntries WHERE AliasID = @varAliasID AND EntryType <> 'Private' AND EntryType <> 'Friends'

IF @varRelationship = 'Unsigned'
 SELECT @outNumberOfEntries = COUNT(*) FROM TableEntries WHERE AliasID = @varAliasID AND EntryType = 'Public'

SET @outNumberOfTables = @outNumberOfEntries / 50
SET @outNumberOfLeftovers = (@outNumberOfEntries - (@outNumberOfTABLES * 50))

GO
0
 
FractureCommented:
Ok I dont create parameters the same way as you in my code but would there be a problem with naming them differently to the ones in the Stored Proc?

If not:

Check out this link

http://vyaskn.tripod.com/repl_ans2.htm#toomany

Fracture

PS In this code

SET @outNumberOfTables = @outNumberOfEntries / 50
SET @outNumberOfLeftovers = (@outNumberOfEntries - (@outNumberOfTABLES * 50))

the @outNumberOfLeftovers is always going to be 0 so you dont need SQL Server to do this :)
0
 
FractureCommented:
Ok I dont create parameters the same way as you in my code but would there be a problem with naming them differently to the ones in the Stored Proc?

If not:

Check out this link

http://vyaskn.tripod.com/repl_ans2.htm#toomany

Fracture

PS In this code

SET @outNumberOfTables = @outNumberOfEntries / 50
SET @outNumberOfLeftovers = (@outNumberOfEntries - (@outNumberOfTABLES * 50))

the @outNumberOfLeftovers is always going to be 0 so you dont need SQL Server to do this :)
0
 
GaryCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by gladxml

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 6
  • 5
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now