We help IT Professionals succeed at work.
Get Started

Error, Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

elliottbenzle
on
825 Views
Last Modified: 2012-05-05
I'm trying to insert some data into my database. I'm getting the error message: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.   /flagfootball/updatescheduleupload.asp, line 50


In access all of the fields are set to text.

Here is the insert code I'm using with line 50 marked:

Sub sAddSchedule(pvardate, pvartime, phometeam, pawayteam, pfield)
Set cinsert = Server.CreateObject ("ADODB.Command")
cinsert.ActiveConnection = MM_flagfootball_STRING

cInsert.CommandText = "INSERT INTO [" & league & "] ( vardate, vartime, varhome, varaway, varfield) VALUES ( ?, ?, ?, ?, ? ) "
 
cInsert.Parameters.Append cInsert.Createparameter("date", adVarchar, adParamInput,10,pvardate)
cInsert.Parameters.Append cInsert.Createparameter("time", adVarchar, adParamInput,10,pvartime)
cInsert.Parameters.Append cInsert.Createparameter("hometeam", adVarchar, adParamInput,50,phometeam )
cInsert.Parameters.Append cInsert.Createparameter("awayteam", adVarchar, adParamInput,50,pawayteam)
cInsert.Parameters.Append cInsert.Createparameter("field", adVarchar, adParamInput,100,pfield)

cinsert.CommandType = 1
cinsert.CommandTimeout = 0
cinsert.Prepared = true
cinsert.Execute()
End Sub

Any ideas what I'm dong wrong? Thanks.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/flagfootball.asp" -->
<%
Dim rshilliardmicroschedule
Dim rshilliardmicroschedule_cmd
Dim rshilliardmicroschedule_numRows
 
Set rshilliardmicroschedule_cmd = Server.CreateObject ("ADODB.Command")
rshilliardmicroschedule_cmd.ActiveConnection = MM_flagfootball_STRING
rshilliardmicroschedule_cmd.CommandText = "SELECT * FROM hilliardmicroschedule" 
rshilliardmicroschedule_cmd.Prepared = true
 
Set rshilliardmicroschedule = rshilliardmicroschedule_cmd.Execute
rshilliardmicroschedule_numRows = 0
 
Dim i, vardate, vartime, hometeam, awayteam, varfield, timeampm, tfhourtime
  For i = 1 To 5
    vardate = "vardate" & i
	vartime = "vartime" & i
	timeampm = "timeampm" & i
	hometeam = "hometeam" & i
	awayteam = "awayteam" & i
	varfield = "varfield" & i
	If Request.Form(timeampm) = "AM" Then
	tfhourtime = Request.Form(vartime)
	End if
	If Request.Form(timeampm) = "PM" Then
	tfhourtime = DATEADD("hh",12,request.form(vartime))
 
	End if
	
	response.write (tfhourtime)
    If Request.Form(vardate) <> "" Then
      'Insert the schedule entered
      Call sAddSchedule(Request.Form(vardate), Request.Form(vartime), Request.Form(hometeam), Request.Form(awayteam), Request.Form(varfield))
    End If
  Next
 
Dim league
league = (request.form("league"))
response.write (league)
 
 
Sub sAddSchedule(pvardate, pvartime, phometeam, pawayteam, pfield)
Set cinsert = Server.CreateObject ("ADODB.Command")
cinsert.ActiveConnection = MM_flagfootball_STRING
 
cInsert.CommandText = "INSERT INTO [" & league & "] ( vardate, vartime, varhome, varaway, varfield) VALUES ( ?, ?, ?, ?, ? ) "
 
cInsert.Parameters.Append cInsert.Createparameter("date", adVarchar, adParamInput,10,pvardate)
cInsert.Parameters.Append cInsert.Createparameter("time", adVarchar, adParamInput,10,pvartime)
cInsert.Parameters.Append cInsert.Createparameter("hometeam", adVarchar, adParamInput,50,phometeam )
cInsert.Parameters.Append cInsert.Createparameter("awayteam", adVarchar, adParamInput,50,pawayteam)
cInsert.Parameters.Append cInsert.Createparameter("field", adVarchar, adParamInput,100,pfield)
 
cinsert.CommandType = 1
cinsert.CommandTimeout = 0
cinsert.Prepared = true
cinsert.Execute()
End Sub 
%>
<!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=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #666666;
	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
	padding: 0;
	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
	color: #000000;
}
.oneColFixCtrHdr #container {
	width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
	background: #FFFFFF;
	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
	border: 1px solid #000000;
	text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColFixCtrHdr #header {
	background: #DDDDDD; 
	padding: 0 10px 0 20px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
}
.oneColFixCtrHdr #header h1 {
	margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
	padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.oneColFixCtrHdr #mainContent {
	padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
	background: #FFFFFF;
}
.oneColFixCtrHdr #footer {
	padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
	background:#DDDDDD;
}
.oneColFixCtrHdr #footer p {
	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
	padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
-->
</style></head>
 
<body class="oneColFixCtrHdr">
 
<div id="container">
  <div id="header">
    <h1 align="center">Update Add Schedule</h1>
    <!-- end #header --></div>
  <div id="mainContent">
    <h1>&nbsp;</h1>
    <!-- end #mainContent --></div>
  <div id="footer">
    <p>&nbsp;</p>
  <!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>
<%
rshilliardmicroschedule.Close()
Set rshilliardmicroschedule = Nothing
%>

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE