Change:
@wk1 VarChar (1), @powk1 VarChar (1)
To:
@wk1 int, @powk1 int
The error tells you that there is a datatype mismatch and from your query string these two values look numeric so are probably int in your table. You should always match the parameters with the fields for datatype.
The stored procedure will not accept an array of parameters if that is what you are trying to accomplish, since your query string shows 3 rows of data.
Provide your code that processes the query string if you are still having troubles.
I suspect that you are also having troubles parsing the query string as it expects unique parameter naming and you have 3 sets of duplicate parameters.
Andy
Thank you Andy and you are right about parsing out the data.
I have a form that is repeating the data rows. So, instead of passing form values like the following:
rosterID = 23
memberID = 55-551
wk1 = 1
powk1 = 1
and my Sp updates where those values are true. Works great with the above but when I repeat the data rows like the following:
rosterID = 23 memberID = 55-551 wk1 = 1 powk1 = 1
rosterID = 23 memberID = 55-552 wk1 = 1 powk1 = 1
rosterID = 23 memberID = 55-553 wk1 = 1 powk1 = 2
rosterID = 23 memberID = 55-551 wk1 = 1 powk1 = 2
I changed wk1 and powk1 to int but it still fails. The only field I am trying to update is powk1 which would represent the poition a member played on a team during the week one playoff matches. I wrongly assumed that if you repeat the row of data that the stored procedure would automatically pick up the repeated rows. Is there a way to update each row of data that the form is passing to the stored procedure?
Andy this is the asp page that post the form with the form fields. I receive the values as Request.Form values.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/TwoOneGender.asp" -->
<%
Dim ROSTERLIST
Dim ROSTERLIST_numRows
Set ROSTERLIST = Server.CreateObject("ADODB.Recordset")
ROSTERLIST.ActiveConnection = MM_TwoOneGender_STRING
ROSTERLIST.Source = "SELECT * FROM dbo.memberPlayWeek WHERE rosterID = 23"
ROSTERLIST.CursorType = 0
ROSTERLIST.CursorLocation = 2
ROSTERLIST.LockType = 1
ROSTERLIST.Open()
ROSTERLIST_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
ROSTERLIST_numRows = ROSTERLIST_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 9pt;
color: 232323;
}
.style1 {font-size: 8pt}
-->
</style></head>
<body>
<table width="750">
<tr>
<td><table width="750">
<tr>
<td><form action="UPDATEscorecard.asp" method="post" name="form1" id="form1">
<table width="861">
<tr>
<td> </td>
<td><div align="center"></div></td>
<td> </td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
</tr>
<tr>
<td width="147"><div align="right"><a href="UPDATEscorecardOld.asp?rosterID=<%=(ROSTERLIST.Fields.Item("rosterID").Value)%>&memberID=<%=(ROSTERLIST.Fields.Item("memberID").Value)%>"></a></div></td>
<td width="71"><div align="center"></div></td>
<td width="90"> </td>
<td width="119"><div align="center"></div></td>
<td width="124"><div align="center"></div></td>
<td width="10"><div align="center"></div></td>
<td width="15"><div align="center"></div></td>
<td width="84"><div align="center"></div></td>
<td width="161"><div align="center"></div></td>
</tr>
<tr>
<td> </td>
<td><div align="center"></div></td>
<td> </td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT ROSTERLIST.EOF))
%>
<tr valign="bottom">
<td><span class="style1">Enter Weekly Position --> </span></td>
<td><div align="center">
<input name="powk1" type="text" id="powk1" size="5" maxlength="1" />
</div></td>
<td><input name="rosterID" type="hidden" id="rosterID" value="<%=(ROSTERLIST.Fields.Item("rosterID").Value)%>" />
<input name="memberID" type="hidden" id="memberID" value="<%=(ROSTERLIST.Fields.Item("memberID").Value)%>" />
<input name="wk1" type="hidden" id="wk1" value="1" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
ROSTERLIST.MoveNext()
Wend
%>
<tr>
<td> </td>
<td><div align="center"></div></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><div align="center">
<input type="submit" name="Submit" value="Submit" />
</div></td>
<td> </td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
</tr>
</table>
</form>
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<%
ROSTERLIST.Close()
Set ROSTERLIST = Nothing
%>
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply