473,396 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Specified argument was out of the range of valid values. Parameter name: 0

Hello all, surprisingly enough, this is my first newsgroup post, I usually
rely on google. So I hope I have enough info contained. Thank you in
advance for any help!

Problem:

I am getting this error when I try to pull up my edit page to display the
current database information in the form, and then edit it on click:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Specified argument was out of the range of valid values. Parameter name: 0
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Specified argument
was out of the range of valid values. Parameter name: 0


The field that I have tracked down that is causing the error appears to be
vehiclewarrantyyears - the field in the db is Int field with 4 chars
allowing nulls.

Any Ideas would be VERY much appreciated!!!! Thanks!


Here is my code:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%
Dim conSiteData As SqlConnection
Dim cmdSelectAll As SqlCommand
Dim dtrSiteDetails As SqlDataReader
Dim conSelectRow As SqlConnection
Dim cmdSelectRow As SqlCommand
Dim dtrRowData As SqlDataReader
conSiteData = New SqlConnection( "Server info here" )
conSiteData.Open()
cmdSelectAll = New SqlCommand( "SELECT * FROM sitedata",conSiteData )
dtrSiteDetails = cmdSelectAll.ExecuteReader()
dtrSiteDetails.Read()
conSelectRow = New SqlConnection( "server info here" )
conSelectRow.Open()
cmdSelectRow = New SqlCommand( "SELECT * FROM vehicles WHERE ID=" &
Request.QueryString("ID"), conSelectRow )
dtrRowData = cmdSelectRow.ExecuteReader()
dtrRowData.Read()

If dtrRowData.HasRows = False Then
Session("error") = "true"
Response.Redirect( "editvehicle.aspx" )
End If
vehiclelocation.SelectedValue = dtrRowData("vehiclelocation").ToString()
vehicleyear.SelectedValue = dtrRowData("vehicleyear").ToString()
vehiclesellingprice.Text =
FormatNumber(dtrRowData("vehiclesellingprice").ToS tring(), 0,,,false)
vehiclemileage.Text = FormatNumber(dtrRowData("vehiclemileage").ToString (),
0,,,false)
vehicleexteriorcolor.Text = dtrRowData("vehicleexteriorcolor").ToString()
vehicletransmission.SelectedValue =
dtrRowData("vehicletransmission").ToString()
vehiclevinnumber.Text = dtrRowData("vehiclevinnumber").ToString()
vehiclestocknumber.Text = dtrRowData("vehiclestocknumber").ToString()

vehiclewarrantyyears.SelectedValue =
dtrRowData("vehiclewarrantyyears").ToString()

vehiclewarrantymiles.Text =
FormatNumber(dtrRowData("vehiclewarrantymiles").To String(), 0,,,false)
vehicleenginetype.Text = dtrRowData("vehicleenginetype").ToString()
vehiclebodystyle.SelectedValue = dtrRowData("vehiclebodystyle").ToString()
vehicleinteriortype.SelectedValue =
dtrRowData("vehicleinteriortype").ToString()
vehicleinteriorcolor.Text = dtrRowData("vehicleinteriorcolor").ToString()
vehicleequipment.Text = dtrRowData("vehicleequipment").ToString()

Dim strSpecial As String
strSpecial = dtrRowData("specialvehicle")

If strSpecial = 0 Then
specialvehicle.Checked = False
ElseIf strSpecial = 1 Then
specialvehicle.Checked = True
End If

lblManu.Text = dtrRowData("vehiclemanufacturer").ToString()
lblModel.Text = dtrRowData("vehiclemodel").ToString()

%>
<SCRIPT Runat="Server">
Sub btnSubmitNoPic_Click( s As Object, e As EventArgs )
If IsValid Then
Dim conMyCn As SqlConnection
Dim strUpdate As String
Dim cmdUpdate As SqlCommand
conMyCn = New SqlConnection(
"Server=S39800\CARSDELUXE;uid=sa;pwd=dev04;databas e=uvims_hondaofhawaii" )

strUpdate = "Update vehicles Set vehiclelocation=@vehiclelocation,
vehicleyear=@vehicleyear, vehiclesellingprice=@vehiclesellingprice,
vehiclemileage=@vehiclemileage, vehicleexteriorcolor=@vehicleexteriorcolor,
vehicletransmission=@vehicletransmission,
vehiclevinnumber=@vehiclevinnumber, vehiclestocknumber=@vehiclestocknumber,
vehiclewarrantyyears=@vehiclewarrantyyears,
vehiclewarrantymiles=@vehiclewarrantymiles,
vehicleenginetype=@vehicleenginetype, vehiclebodystyle=@vehiclebodystyle,
vehicleequipment=@vehicleequipment,
vehicleinteriortype=@vehicleinteriortype,
vehicleinteriorcolor=@vehicleinteriorcolor, specialvehicle=@specialvehicle
WHERE ID=" & Request.QueryString("ID")
cmdUpdate = New SqlCommand( strUpdate, conMyCn )

cmdUpdate.Parameters.Add( "@vehiclelocation",
vehiclelocation.SelectedValue )
cmdUpdate.Parameters.Add( "@vehicleyear", SqlDbType.Int ).Value =
vehicleyear.SelectedItem.Value
cmdUpdate.Parameters.Add( "@vehiclesellingprice", SqlDbType.Money ).Value =
vehiclesellingprice.Text
cmdUpdate.Parameters.Add( "@vehiclemileage", SqlDbType.Int ).Value =
vehiclemileage.Text
cmdUpdate.Parameters.Add( "@vehicleexteriorcolor",
vehicleexteriorcolor.Text )
cmdUpdate.Parameters.Add( "@vehicletransmission",
vehicletransmission.SelectedItem.Value )
cmdUpdate.Parameters.Add( "@vehiclevinnumber", vehiclevinnumber.Text )
cmdUpdate.Parameters.Add( "@vehiclestocknumber", vehiclestocknumber.Text )

cmdUpdate.Parameters.Add( "@vehiclewarrantyyears", SqlDbType.Int ).Value =
vehiclewarrantyyears.SelectedItem.Value


cmdUpdate.Parameters.Add( "@vehiclewarrantymiles", SqlDbType.Int ).Value =
vehiclewarrantymiles.Text
cmdUpdate.Parameters.Add( "@vehicleenginetype", vehicleenginetype.Text )
cmdUpdate.Parameters.Add( "@vehiclebodystyle",
vehiclebodystyle.SelectedItem.Value )
cmdUpdate.Parameters.Add( "@vehicleequipment", vehicleequipment.Text )
cmdUpdate.Parameters.Add( "@vehicleinteriortype",
vehicleinteriortype.SelectedItem.Value )
cmdUpdate.Parameters.Add( "@vehicleinteriorcolor",
vehicleinteriorcolor.Text )
If specialvehicle.Checked Then
cmdUpdate.Parameters.Add( "@specialvehicle", SqlDbType.Int ).Value = 1
Else
cmdUpdate.Parameters.Add( "@specialvehicle", SqlDbType.Int ).Value = 0
End If

conMyCn.Open()
cmdUpdate.ExecuteNonQuery()
conMyCn.Close()

Session("success") = "true"
Response.Redirect( "editvehicle.aspx" )
End If
End Sub



</SCRIPT>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><%=(dtrSiteDetails("sitepagetitles"))%></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta NAME="keywords" CONTENT="<%=(dtrSiteDetails("sitemetakeywords"))%> ">
<meta NAME="description"
CONTENT="<%=(dtrSiteDetails("sitemetadescription") )%>">

</head>

<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CC0000"><img src="../images/admin_logo.gif" border="0"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>

<td bgcolor="#000000"><img src="../images/admin_navigation.jpg"
border="0" usemap="#Map"></td>
</tr>
</table>

<table width="750" border="0" cellpadding="10" cellspacing="0">
<tr>
<td>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#F7F7F7">

<img src="../images/headereditvehicle2.jpg">

</td>
</tr>
</table>

<p>

<form EncType="multipart/form-data" Runat="Server">

<asp:ValidationSummary
HeaderText="There are problems within the form."
DisplayMode="BulletList"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
Runat="Server" />

<asp:Label
ID="lblManu"
Font-Size="24pt"
ForeColor="#777777"
Font-Names="Arial,Helvetica"
Runat="Server" />

<asp:Label
ID="lblModel"
Font-Size="14pt"
ForeColor="#777777"
Font-Names="Arial,Helvetica"
Font-Italic="True"
Runat="Server" />

<p>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#000000"> <table width="100%" border="0" cellspacing="0"
cellpadding="3">
<tr>
<td width="60%" valign="top" bgcolor="#CC0000">
<table width="423" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="211"> <asp:Label
Text="Year"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:DropDownList
ID="vehicleyear"
Runat="Server">
<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="1950" />
<asp:ListItem Text="1951" />
<asp:ListItem Text="1952" />
<asp:ListItem Text="1953" />
<asp:ListItem Text="1954" />
<asp:ListItem Text="1955" />
<asp:ListItem Text="1956" />
<asp:ListItem Text="1957" />
<asp:ListItem Text="1958" />
<asp:ListItem Text="1959" />
<asp:ListItem Text="1960" />
<asp:ListItem Text="1961" />
<asp:ListItem Text="1962" />
<asp:ListItem Text="1963" />
<asp:ListItem Text="1964" />
<asp:ListItem Text="1965" />
<asp:ListItem Text="1966" />
<asp:ListItem Text="1967" />
<asp:ListItem Text="1968" />
<asp:ListItem Text="1969" />
<asp:ListItem Text="1970" />
<asp:ListItem Text="1971" />
<asp:ListItem Text="1972" />
<asp:ListItem Text="1973" />
<asp:ListItem Text="1974" />
<asp:ListItem Text="1975" />
<asp:ListItem Text="1976" />
<asp:ListItem Text="1977" />
<asp:ListItem Text="1978" />
<asp:ListItem Text="1979" />
<asp:ListItem Text="1980" />
<asp:ListItem Text="1981" />
<asp:ListItem Text="1982" />
<asp:ListItem Text="1983" />
<asp:ListItem Text="1984" />
<asp:ListItem Text="1985" />
<asp:ListItem Text="1986" />
<asp:ListItem Text="1987" />
<asp:ListItem Text="1988" />
<asp:ListItem Text="1989" />
<asp:ListItem Text="1990" />
<asp:ListItem Text="1991" />
<asp:ListItem Text="1992" />
<asp:ListItem Text="1993" />
<asp:ListItem Text="1994" />
<asp:ListItem Text="1995" />
<asp:ListItem Text="1996" />
<asp:ListItem Text="1997" />
<asp:ListItem Text="1998" />
<asp:ListItem Text="1999" />
<asp:ListItem Text="2000" />
<asp:ListItem Text="2001" />
<asp:ListItem Text="2002" />
<asp:ListItem Text="2003" />
<asp:ListItem Text="2004" />
<asp:ListItem Text="2005" />
<asp:ListItem Text="2006" /> </asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
ControlToValidate="vehicleyear"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
InitialValue="Please Choose"
ErrorMessage="You must select a vehicle year"
Text="*"
Runat="Server" />

</td>
<td width="212"> <asp:Label
Text="Selling Price"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclesellingprice"
MaxLength="8"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ErrorMessage="Selling price should be entered as 5555 do not enter any
characters other then numbers"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ControlToValidate="vehiclesellingprice"
Text="*"
ValidationExpression="^[^,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ!@#$%^&*.]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="You must enter a selling price"
ControlToValidate="vehiclesellingprice"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Mileage"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclemileage"
MaxLength="8"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ErrorMessage="Vehicle mileage should be entered as 55555 and cannot
contain any characters other than numbers"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ControlToValidate="vehiclemileage"
Text="*"
ValidationExpression="^[^,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ!@#$%^&*.]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="You must include the vehicle mileage"
ControlToValidate="vehiclemileage"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Exterior Color"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleexteriorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Exterior color cannot contain any special characters"
ControlToValidate="vehicleexteriorcolor"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="You must include an exterior color"
ControlToValidate="vehicleexteriorcolor"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Transmission Type"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehicletransmission"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Automatic" />
<asp:ListItem Text="Manual" />

</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="You must include the vehicle transmission type"
InitialValue="Please Choose"
ControlToValidate="vehicletransmission"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Vin Number"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclevinnumber"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="VIN number cannot contain any special characters"
ControlToValidate="vehiclevinnumber"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
ForeColor="#ffffff"
Font-Size="8pt"
ErrorMessage="You must include the vehicle VIN number"
ControlToValidate="vehiclevinnumber"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Stock Number"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclestocknumber"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Stock number cannot contain any special characters. Only
letter and number combinations are accepted"
ControlToValidate="vehiclestocknumber"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Please include a vehicle stock number"
ControlToValidate="vehiclestocknumber"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Warranty Years"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehiclewarrantyyears"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="1" />
<asp:ListItem Text="2" />
<asp:ListItem Text="3" />
<asp:ListItem Text="4" />
<asp:ListItem Text="5" />
<asp:ListItem Text="6" />
<asp:ListItem Text="7" />
<asp:ListItem Text="8" />
<asp:ListItem Text="9" />
<asp:ListItem Text="10" />

</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please select warranty years"
InitialValue="Please Choose"
ControlToValidate="vehiclewarrantyyears"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Warranty Miles"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclewarrantymiles"
MaxLength="8"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Warranty miles must contain only a number with no commas or
periods"
ControlToValidate="vehiclewarrantymiles"
Text="*"
ValidationExpression="^[^,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ!@#$%^&*.]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please include warranty miles"
ControlToValidate="vehiclewarrantymiles"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Engine Type"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleenginetype"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Engine type must not contain any special characters"
ControlToValidate="vehicleenginetype"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please include an engine type"
ControlToValidate="vehicleenginetype"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Body Style"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehiclebodystyle"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Convertible" />
<asp:ListItem Text="Sedan" />
<asp:ListItem Text="Coupe" />
<asp:ListItem Text="SUV" />
<asp:ListItem Text="HatchBack" />
<asp:ListItem Text="Truck" />
<asp:ListItem Text="Mini Van" />
<asp:ListItem Text="Van" />
<asp:ListItem Text="Wagon" />

</asp:DropDownList>


<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Please select a body style"
InitialValue="Please Choose"
ControlToValidate="vehiclebodystyle"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Interior Type"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehicleinteriortype"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Fabric" />
<asp:ListItem Text="Leather" />

</asp:DropDownList>
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please select an interior type"
InitialValue="Please Choose"
ControlToValidate="vehicleinteriortype"
Text="*"
Runat="Server" />
</td>
</tr>
<tr>
<td> <asp:Label
Text="Interior Color"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleinteriorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Interior color cannot contain any special characters"
ControlToValidate="vehicleinteriorcolor"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Interior color is required"
ControlToValidate="vehicleinteriorcolor"
Text="*"
Runat="Server" />

</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2">

<asp:Label
Text="Equipment"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" />

<br>
<asp:TextBox
ID="vehicleequipment"
Columns="43"
Rows="7"
TextMode="MultiLine"
MaxLength="1000"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Vehicle equipment cannot contain any special characters"
ControlToValidate="vehicleequipment"
Text="*"
ValidationExpression="^[^@#^*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please include vehicle equipment"
ControlToValidate="vehicleequipment"
Text="*"
Runat="Server" />
<p>

<asp:CheckBox
ID="specialvehicle"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Text="Put this vehicle on special"
Runat="Server" />

<asp:Label
Text="Vehicle Location"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" />

<br>
<asp:DropDownList
ID="vehiclelocation"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Kailua Kona" />
<asp:ListItem Text="Hilo" />

</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
ControlToValidate="vehiclelocation"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
InitialValue="Please Choose"
ErrorMessage="You must select a vehicle location"
Text="*"
Runat="Server" />
</td>
</tr>
</table>

</td>
<td width="40%" valign="top" align="center">

<img src="../images/bigedit.jpg" border="0">
</td>
</tr>
</table>



</td>
</tr>
</table>



<p>
<asp:Button
ID="btnSubmitNoPic"
Text="Update Vehicle"
OnClick="btnSubmitNoPic_Click"
Runat="Server" />






</form>

</td>
</tr>
</table>



<map name="Map">
<area shape="rect" coords="2,1,153,21" href="addvehicle.aspx">
<area shape="rect" coords="155,0,294,32" href="deletevehicle.aspx">
<area shape="rect" coords="295,0,436,28" href="editvehicle.aspx">
<area shape="rect" coords="438,0,580,21" href="imagecenter.aspx">
</map>
</body>
</html>

<%
dtrSiteDetails.Close()
conSiteData.Close()
dtrRowData.Close()
conSelectRow.Close()
%>





Nov 18 '05 #1
4 16941
I should also say that the error only appears to be happening when
vehiclewarrantyyear field has a value of 0 in the database.

Thanks!

"Todd Perkins" <to**@static9.com> wrote in message
news:pZ*******************@bignews5.bellsouth.net. ..
Hello all, surprisingly enough, this is my first newsgroup post, I usually
rely on google. So I hope I have enough info contained. Thank you in
advance for any help!

Problem:

I am getting this error when I try to pull up my edit page to display the
current database information in the form, and then edit it on click:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Specified argument was out of the range of valid values. Parameter name: 0
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Specified argument
was out of the range of valid values. Parameter name: 0


The field that I have tracked down that is causing the error appears to be
vehiclewarrantyyears - the field in the db is Int field with 4 chars
allowing nulls.

Any Ideas would be VERY much appreciated!!!! Thanks!


Here is my code:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%
Dim conSiteData As SqlConnection
Dim cmdSelectAll As SqlCommand
Dim dtrSiteDetails As SqlDataReader
Dim conSelectRow As SqlConnection
Dim cmdSelectRow As SqlCommand
Dim dtrRowData As SqlDataReader
conSiteData = New SqlConnection( "Server info here" )
conSiteData.Open()
cmdSelectAll = New SqlCommand( "SELECT * FROM sitedata",conSiteData )
dtrSiteDetails = cmdSelectAll.ExecuteReader()
dtrSiteDetails.Read()
conSelectRow = New SqlConnection( "server info here" )
conSelectRow.Open()
cmdSelectRow = New SqlCommand( "SELECT * FROM vehicles WHERE ID=" &
Request.QueryString("ID"), conSelectRow )
dtrRowData = cmdSelectRow.ExecuteReader()
dtrRowData.Read()

If dtrRowData.HasRows = False Then
Session("error") = "true"
Response.Redirect( "editvehicle.aspx" )
End If
vehiclelocation.SelectedValue = dtrRowData("vehiclelocation").ToString()
vehicleyear.SelectedValue = dtrRowData("vehicleyear").ToString()
vehiclesellingprice.Text =
FormatNumber(dtrRowData("vehiclesellingprice").ToS tring(), 0,,,false)
vehiclemileage.Text =
FormatNumber(dtrRowData("vehiclemileage").ToString (), 0,,,false)
vehicleexteriorcolor.Text = dtrRowData("vehicleexteriorcolor").ToString()
vehicletransmission.SelectedValue =
dtrRowData("vehicletransmission").ToString()
vehiclevinnumber.Text = dtrRowData("vehiclevinnumber").ToString()
vehiclestocknumber.Text = dtrRowData("vehiclestocknumber").ToString()

vehiclewarrantyyears.SelectedValue =
dtrRowData("vehiclewarrantyyears").ToString()

vehiclewarrantymiles.Text =
FormatNumber(dtrRowData("vehiclewarrantymiles").To String(), 0,,,false)
vehicleenginetype.Text = dtrRowData("vehicleenginetype").ToString()
vehiclebodystyle.SelectedValue = dtrRowData("vehiclebodystyle").ToString()
vehicleinteriortype.SelectedValue =
dtrRowData("vehicleinteriortype").ToString()
vehicleinteriorcolor.Text = dtrRowData("vehicleinteriorcolor").ToString()
vehicleequipment.Text = dtrRowData("vehicleequipment").ToString()

Dim strSpecial As String
strSpecial = dtrRowData("specialvehicle")

If strSpecial = 0 Then
specialvehicle.Checked = False
ElseIf strSpecial = 1 Then
specialvehicle.Checked = True
End If

lblManu.Text = dtrRowData("vehiclemanufacturer").ToString()
lblModel.Text = dtrRowData("vehiclemodel").ToString()

%>
<SCRIPT Runat="Server">
Sub btnSubmitNoPic_Click( s As Object, e As EventArgs )
If IsValid Then
Dim conMyCn As SqlConnection
Dim strUpdate As String
Dim cmdUpdate As SqlCommand
conMyCn = New SqlConnection(
"Server=S39800\CARSDELUXE;uid=sa;pwd=dev04;databas e=uvims_hondaofhawaii" )

strUpdate = "Update vehicles Set vehiclelocation=@vehiclelocation,
vehicleyear=@vehicleyear, vehiclesellingprice=@vehiclesellingprice,
vehiclemileage=@vehiclemileage,
vehicleexteriorcolor=@vehicleexteriorcolor,
vehicletransmission=@vehicletransmission,
vehiclevinnumber=@vehiclevinnumber,
vehiclestocknumber=@vehiclestocknumber,
vehiclewarrantyyears=@vehiclewarrantyyears,
vehiclewarrantymiles=@vehiclewarrantymiles,
vehicleenginetype=@vehicleenginetype, vehiclebodystyle=@vehiclebodystyle,
vehicleequipment=@vehicleequipment,
vehicleinteriortype=@vehicleinteriortype,
vehicleinteriorcolor=@vehicleinteriorcolor, specialvehicle=@specialvehicle
WHERE ID=" & Request.QueryString("ID")
cmdUpdate = New SqlCommand( strUpdate, conMyCn )

cmdUpdate.Parameters.Add( "@vehiclelocation",
vehiclelocation.SelectedValue )
cmdUpdate.Parameters.Add( "@vehicleyear", SqlDbType.Int ).Value =
vehicleyear.SelectedItem.Value
cmdUpdate.Parameters.Add( "@vehiclesellingprice", SqlDbType.Money ).Value
= vehiclesellingprice.Text
cmdUpdate.Parameters.Add( "@vehiclemileage", SqlDbType.Int ).Value =
vehiclemileage.Text
cmdUpdate.Parameters.Add( "@vehicleexteriorcolor",
vehicleexteriorcolor.Text )
cmdUpdate.Parameters.Add( "@vehicletransmission",
vehicletransmission.SelectedItem.Value )
cmdUpdate.Parameters.Add( "@vehiclevinnumber", vehiclevinnumber.Text )
cmdUpdate.Parameters.Add( "@vehiclestocknumber", vehiclestocknumber.Text )

cmdUpdate.Parameters.Add( "@vehiclewarrantyyears", SqlDbType.Int ).Value =
vehiclewarrantyyears.SelectedItem.Value


cmdUpdate.Parameters.Add( "@vehiclewarrantymiles", SqlDbType.Int ).Value =
vehiclewarrantymiles.Text
cmdUpdate.Parameters.Add( "@vehicleenginetype", vehicleenginetype.Text )
cmdUpdate.Parameters.Add( "@vehiclebodystyle",
vehiclebodystyle.SelectedItem.Value )
cmdUpdate.Parameters.Add( "@vehicleequipment", vehicleequipment.Text )
cmdUpdate.Parameters.Add( "@vehicleinteriortype",
vehicleinteriortype.SelectedItem.Value )
cmdUpdate.Parameters.Add( "@vehicleinteriorcolor",
vehicleinteriorcolor.Text )
If specialvehicle.Checked Then
cmdUpdate.Parameters.Add( "@specialvehicle", SqlDbType.Int ).Value = 1
Else
cmdUpdate.Parameters.Add( "@specialvehicle", SqlDbType.Int ).Value = 0
End If

conMyCn.Open()
cmdUpdate.ExecuteNonQuery()
conMyCn.Close()

Session("success") = "true"
Response.Redirect( "editvehicle.aspx" )
End If
End Sub



</SCRIPT>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><%=(dtrSiteDetails("sitepagetitles"))%></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta NAME="keywords" CONTENT="<%=(dtrSiteDetails("sitemetakeywords"))%> ">
<meta NAME="description"
CONTENT="<%=(dtrSiteDetails("sitemetadescription") )%>">

</head>

<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CC0000"><img src="../images/admin_logo.gif"
border="0"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>

<td bgcolor="#000000"><img src="../images/admin_navigation.jpg"
border="0" usemap="#Map"></td>
</tr>
</table>

<table width="750" border="0" cellpadding="10" cellspacing="0">
<tr>
<td>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#F7F7F7">

<img src="../images/headereditvehicle2.jpg">

</td>
</tr>
</table>

<p>

<form EncType="multipart/form-data" Runat="Server">

<asp:ValidationSummary
HeaderText="There are problems within the form."
DisplayMode="BulletList"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
Runat="Server" />

<asp:Label
ID="lblManu"
Font-Size="24pt"
ForeColor="#777777"
Font-Names="Arial,Helvetica"
Runat="Server" />

<asp:Label
ID="lblModel"
Font-Size="14pt"
ForeColor="#777777"
Font-Names="Arial,Helvetica"
Font-Italic="True"
Runat="Server" />

<p>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#000000"> <table width="100%" border="0" cellspacing="0"
cellpadding="3">
<tr>
<td width="60%" valign="top" bgcolor="#CC0000">
<table width="423" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="211"> <asp:Label
Text="Year"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:DropDownList
ID="vehicleyear"
Runat="Server">
<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="1950" />
<asp:ListItem Text="1951" />
<asp:ListItem Text="1952" />
<asp:ListItem Text="1953" />
<asp:ListItem Text="1954" />
<asp:ListItem Text="1955" />
<asp:ListItem Text="1956" />
<asp:ListItem Text="1957" />
<asp:ListItem Text="1958" />
<asp:ListItem Text="1959" />
<asp:ListItem Text="1960" />
<asp:ListItem Text="1961" />
<asp:ListItem Text="1962" />
<asp:ListItem Text="1963" />
<asp:ListItem Text="1964" />
<asp:ListItem Text="1965" />
<asp:ListItem Text="1966" />
<asp:ListItem Text="1967" />
<asp:ListItem Text="1968" />
<asp:ListItem Text="1969" />
<asp:ListItem Text="1970" />
<asp:ListItem Text="1971" />
<asp:ListItem Text="1972" />
<asp:ListItem Text="1973" />
<asp:ListItem Text="1974" />
<asp:ListItem Text="1975" />
<asp:ListItem Text="1976" />
<asp:ListItem Text="1977" />
<asp:ListItem Text="1978" />
<asp:ListItem Text="1979" />
<asp:ListItem Text="1980" />
<asp:ListItem Text="1981" />
<asp:ListItem Text="1982" />
<asp:ListItem Text="1983" />
<asp:ListItem Text="1984" />
<asp:ListItem Text="1985" />
<asp:ListItem Text="1986" />
<asp:ListItem Text="1987" />
<asp:ListItem Text="1988" />
<asp:ListItem Text="1989" />
<asp:ListItem Text="1990" />
<asp:ListItem Text="1991" />
<asp:ListItem Text="1992" />
<asp:ListItem Text="1993" />
<asp:ListItem Text="1994" />
<asp:ListItem Text="1995" />
<asp:ListItem Text="1996" />
<asp:ListItem Text="1997" />
<asp:ListItem Text="1998" />
<asp:ListItem Text="1999" />
<asp:ListItem Text="2000" />
<asp:ListItem Text="2001" />
<asp:ListItem Text="2002" />
<asp:ListItem Text="2003" />
<asp:ListItem Text="2004" />
<asp:ListItem Text="2005" />
<asp:ListItem Text="2006" />
</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
ControlToValidate="vehicleyear"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
InitialValue="Please Choose"
ErrorMessage="You must select a vehicle year"
Text="*"
Runat="Server" />

</td>
<td width="212"> <asp:Label
Text="Selling Price"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclesellingprice"
MaxLength="8"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ErrorMessage="Selling price should be entered as 5555 do not enter any
characters other then numbers"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ControlToValidate="vehiclesellingprice"
Text="*"

ValidationExpression="^[^,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ!@#$%^&*.]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="You must enter a selling price"
ControlToValidate="vehiclesellingprice"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Mileage"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclemileage"
MaxLength="8"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ErrorMessage="Vehicle mileage should be entered as 55555 and cannot
contain any characters other than numbers"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ControlToValidate="vehiclemileage"
Text="*"

ValidationExpression="^[^,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ!@#$%^&*.]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="You must include the vehicle mileage"
ControlToValidate="vehiclemileage"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Exterior Color"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleexteriorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Exterior color cannot contain any special characters"
ControlToValidate="vehicleexteriorcolor"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="You must include an exterior color"
ControlToValidate="vehicleexteriorcolor"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Transmission Type"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehicletransmission"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Automatic" />
<asp:ListItem Text="Manual" />

</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="You must include the vehicle transmission type"
InitialValue="Please Choose"
ControlToValidate="vehicletransmission"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Vin Number"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclevinnumber"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="VIN number cannot contain any special characters"
ControlToValidate="vehiclevinnumber"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
ForeColor="#ffffff"
Font-Size="8pt"
ErrorMessage="You must include the vehicle VIN number"
ControlToValidate="vehiclevinnumber"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Stock Number"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclestocknumber"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Stock number cannot contain any special characters. Only
letter and number combinations are accepted"
ControlToValidate="vehiclestocknumber"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Please include a vehicle stock number"
ControlToValidate="vehiclestocknumber"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Warranty Years"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehiclewarrantyyears"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="1" />
<asp:ListItem Text="2" />
<asp:ListItem Text="3" />
<asp:ListItem Text="4" />
<asp:ListItem Text="5" />
<asp:ListItem Text="6" />
<asp:ListItem Text="7" />
<asp:ListItem Text="8" />
<asp:ListItem Text="9" />
<asp:ListItem Text="10" />

</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please select warranty years"
InitialValue="Please Choose"
ControlToValidate="vehiclewarrantyyears"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Warranty Miles"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclewarrantymiles"
MaxLength="8"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Warranty miles must contain only a number with no commas
or periods"
ControlToValidate="vehiclewarrantymiles"
Text="*"

ValidationExpression="^[^,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ!@#$%^&*.]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please include warranty miles"
ControlToValidate="vehiclewarrantymiles"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Engine Type"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleenginetype"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Engine type must not contain any special characters"
ControlToValidate="vehicleenginetype"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please include an engine type"
ControlToValidate="vehicleenginetype"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Body Style"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehiclebodystyle"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Convertible" />
<asp:ListItem Text="Sedan" />
<asp:ListItem Text="Coupe" />
<asp:ListItem Text="SUV" />
<asp:ListItem Text="HatchBack" />
<asp:ListItem Text="Truck" />
<asp:ListItem Text="Mini Van" />
<asp:ListItem Text="Van" />
<asp:ListItem Text="Wagon" />

</asp:DropDownList>


<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Please select a body style"
InitialValue="Please Choose"
ControlToValidate="vehiclebodystyle"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Interior Type"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehicleinteriortype"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Fabric" />
<asp:ListItem Text="Leather" />

</asp:DropDownList>
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please select an interior type"
InitialValue="Please Choose"
ControlToValidate="vehicleinteriortype"
Text="*"
Runat="Server" />
</td>
</tr>
<tr>
<td> <asp:Label
Text="Interior Color"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleinteriorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Interior color cannot contain any special characters"
ControlToValidate="vehicleinteriorcolor"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Interior color is required"
ControlToValidate="vehicleinteriorcolor"
Text="*"
Runat="Server" />

</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2">

<asp:Label
Text="Equipment"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" />

<br>
<asp:TextBox
ID="vehicleequipment"
Columns="43"
Rows="7"
TextMode="MultiLine"
MaxLength="1000"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Vehicle equipment cannot contain any special characters"
ControlToValidate="vehicleequipment"
Text="*"
ValidationExpression="^[^@#^*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please include vehicle equipment"
ControlToValidate="vehicleequipment"
Text="*"
Runat="Server" />
<p>

<asp:CheckBox
ID="specialvehicle"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Text="Put this vehicle on special"
Runat="Server" />

<asp:Label
Text="Vehicle Location"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" />

<br>
<asp:DropDownList
ID="vehiclelocation"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Kailua Kona" />
<asp:ListItem Text="Hilo" />

</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
ControlToValidate="vehiclelocation"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
InitialValue="Please Choose"
ErrorMessage="You must select a vehicle location"
Text="*"
Runat="Server" />
</td>
</tr>
</table>

</td>
<td width="40%" valign="top" align="center">

<img src="../images/bigedit.jpg" border="0">
</td>
</tr>
</table>



</td>
</tr>
</table>



<p>
<asp:Button
ID="btnSubmitNoPic"
Text="Update Vehicle"
OnClick="btnSubmitNoPic_Click"
Runat="Server" />






</form>

</td>
</tr>
</table>



<map name="Map">
<area shape="rect" coords="2,1,153,21" href="addvehicle.aspx">
<area shape="rect" coords="155,0,294,32" href="deletevehicle.aspx">
<area shape="rect" coords="295,0,436,28" href="editvehicle.aspx">
<area shape="rect" coords="438,0,580,21" href="imagecenter.aspx">
</map>
</body>
</html>

<%
dtrSiteDetails.Close()
conSiteData.Close()
dtrRowData.Close()
conSelectRow.Close()
%>





Nov 18 '05 #2
Is it a 0 or a NULL ?
Also, step through the code and find the line causing the error.
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Todd Perkins" <to**@NOSPAMstatic9.com> wrote in message
news:Ja*******************@bignews5.bellsouth.net. ..
I should also say that the error only appears to be happening when
vehiclewarrantyyear field has a value of 0 in the database.

Thanks!

"Todd Perkins" <to**@static9.com> wrote in message
news:pZ*******************@bignews5.bellsouth.net. ..
Hello all, surprisingly enough, this is my first newsgroup post, I
usually rely on google. So I hope I have enough info contained. Thank
you in advance for any help!

Problem:

I am getting this error when I try to pull up my edit page to display the
current database information in the form, and then edit it on click:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Specified argument was out of the range of valid values. Parameter name:
0
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Specified argument
was out of the range of valid values. Parameter name: 0


The field that I have tracked down that is causing the error appears to
be vehiclewarrantyyears - the field in the db is Int field with 4 chars
allowing nulls.

Any Ideas would be VERY much appreciated!!!! Thanks!


Here is my code:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%
Dim conSiteData As SqlConnection
Dim cmdSelectAll As SqlCommand
Dim dtrSiteDetails As SqlDataReader
Dim conSelectRow As SqlConnection
Dim cmdSelectRow As SqlCommand
Dim dtrRowData As SqlDataReader
conSiteData = New SqlConnection( "Server info here" )
conSiteData.Open()
cmdSelectAll = New SqlCommand( "SELECT * FROM sitedata",conSiteData )
dtrSiteDetails = cmdSelectAll.ExecuteReader()
dtrSiteDetails.Read()
conSelectRow = New SqlConnection( "server info here" )
conSelectRow.Open()
cmdSelectRow = New SqlCommand( "SELECT * FROM vehicles WHERE ID=" &
Request.QueryString("ID"), conSelectRow )
dtrRowData = cmdSelectRow.ExecuteReader()
dtrRowData.Read()

If dtrRowData.HasRows = False Then
Session("error") = "true"
Response.Redirect( "editvehicle.aspx" )
End If
vehiclelocation.SelectedValue = dtrRowData("vehiclelocation").ToString()
vehicleyear.SelectedValue = dtrRowData("vehicleyear").ToString()
vehiclesellingprice.Text =
FormatNumber(dtrRowData("vehiclesellingprice").ToS tring(), 0,,,false)
vehiclemileage.Text =
FormatNumber(dtrRowData("vehiclemileage").ToString (), 0,,,false)
vehicleexteriorcolor.Text = dtrRowData("vehicleexteriorcolor").ToString()
vehicletransmission.SelectedValue =
dtrRowData("vehicletransmission").ToString()
vehiclevinnumber.Text = dtrRowData("vehiclevinnumber").ToString()
vehiclestocknumber.Text = dtrRowData("vehiclestocknumber").ToString()

vehiclewarrantyyears.SelectedValue =
dtrRowData("vehiclewarrantyyears").ToString()

vehiclewarrantymiles.Text =
FormatNumber(dtrRowData("vehiclewarrantymiles").To String(), 0,,,false)
vehicleenginetype.Text = dtrRowData("vehicleenginetype").ToString()
vehiclebodystyle.SelectedValue =
dtrRowData("vehiclebodystyle").ToString()
vehicleinteriortype.SelectedValue =
dtrRowData("vehicleinteriortype").ToString()
vehicleinteriorcolor.Text = dtrRowData("vehicleinteriorcolor").ToString()
vehicleequipment.Text = dtrRowData("vehicleequipment").ToString()

Dim strSpecial As String
strSpecial = dtrRowData("specialvehicle")

If strSpecial = 0 Then
specialvehicle.Checked = False
ElseIf strSpecial = 1 Then
specialvehicle.Checked = True
End If

lblManu.Text = dtrRowData("vehiclemanufacturer").ToString()
lblModel.Text = dtrRowData("vehiclemodel").ToString()

%>
<SCRIPT Runat="Server">
Sub btnSubmitNoPic_Click( s As Object, e As EventArgs )
If IsValid Then
Dim conMyCn As SqlConnection
Dim strUpdate As String
Dim cmdUpdate As SqlCommand
conMyCn = New SqlConnection(
"Server=S39800\CARSDELUXE;uid=sa;pwd=dev04;databas e=uvims_hondaofhawaii"
)

strUpdate = "Update vehicles Set vehiclelocation=@vehiclelocation,
vehicleyear=@vehicleyear, vehiclesellingprice=@vehiclesellingprice,
vehiclemileage=@vehiclemileage,
vehicleexteriorcolor=@vehicleexteriorcolor,
vehicletransmission=@vehicletransmission,
vehiclevinnumber=@vehiclevinnumber,
vehiclestocknumber=@vehiclestocknumber,
vehiclewarrantyyears=@vehiclewarrantyyears,
vehiclewarrantymiles=@vehiclewarrantymiles,
vehicleenginetype=@vehicleenginetype, vehiclebodystyle=@vehiclebodystyle,
vehicleequipment=@vehicleequipment,
vehicleinteriortype=@vehicleinteriortype,
vehicleinteriorcolor=@vehicleinteriorcolor,
specialvehicle=@specialvehicle WHERE ID=" & Request.QueryString("ID")
cmdUpdate = New SqlCommand( strUpdate, conMyCn )

cmdUpdate.Parameters.Add( "@vehiclelocation",
vehiclelocation.SelectedValue )
cmdUpdate.Parameters.Add( "@vehicleyear", SqlDbType.Int ).Value =
vehicleyear.SelectedItem.Value
cmdUpdate.Parameters.Add( "@vehiclesellingprice", SqlDbType.Money ).Value
= vehiclesellingprice.Text
cmdUpdate.Parameters.Add( "@vehiclemileage", SqlDbType.Int ).Value =
vehiclemileage.Text
cmdUpdate.Parameters.Add( "@vehicleexteriorcolor",
vehicleexteriorcolor.Text )
cmdUpdate.Parameters.Add( "@vehicletransmission",
vehicletransmission.SelectedItem.Value )
cmdUpdate.Parameters.Add( "@vehiclevinnumber", vehiclevinnumber.Text )
cmdUpdate.Parameters.Add( "@vehiclestocknumber",
vehiclestocknumber.Text )

cmdUpdate.Parameters.Add( "@vehiclewarrantyyears", SqlDbType.Int ).Value
= vehiclewarrantyyears.SelectedItem.Value


cmdUpdate.Parameters.Add( "@vehiclewarrantymiles", SqlDbType.Int ).Value
= vehiclewarrantymiles.Text
cmdUpdate.Parameters.Add( "@vehicleenginetype", vehicleenginetype.Text )
cmdUpdate.Parameters.Add( "@vehiclebodystyle",
vehiclebodystyle.SelectedItem.Value )
cmdUpdate.Parameters.Add( "@vehicleequipment", vehicleequipment.Text )
cmdUpdate.Parameters.Add( "@vehicleinteriortype",
vehicleinteriortype.SelectedItem.Value )
cmdUpdate.Parameters.Add( "@vehicleinteriorcolor",
vehicleinteriorcolor.Text )
If specialvehicle.Checked Then
cmdUpdate.Parameters.Add( "@specialvehicle", SqlDbType.Int ).Value = 1
Else
cmdUpdate.Parameters.Add( "@specialvehicle", SqlDbType.Int ).Value = 0
End If

conMyCn.Open()
cmdUpdate.ExecuteNonQuery()
conMyCn.Close()

Session("success") = "true"
Response.Redirect( "editvehicle.aspx" )
End If
End Sub



</SCRIPT>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><%=(dtrSiteDetails("sitepagetitles"))%></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta NAME="keywords"
CONTENT="<%=(dtrSiteDetails("sitemetakeywords"))%> ">
<meta NAME="description"
CONTENT="<%=(dtrSiteDetails("sitemetadescription") )%>">

</head>

<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CC0000"><img src="../images/admin_logo.gif"
border="0"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>

<td bgcolor="#000000"><img src="../images/admin_navigation.jpg"
border="0" usemap="#Map"></td>
</tr>
</table>

<table width="750" border="0" cellpadding="10" cellspacing="0">
<tr>
<td>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#F7F7F7">

<img src="../images/headereditvehicle2.jpg">

</td>
</tr>
</table>

<p>

<form EncType="multipart/form-data" Runat="Server">

<asp:ValidationSummary
HeaderText="There are problems within the form."
DisplayMode="BulletList"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
Runat="Server" />

<asp:Label
ID="lblManu"
Font-Size="24pt"
ForeColor="#777777"
Font-Names="Arial,Helvetica"
Runat="Server" />

<asp:Label
ID="lblModel"
Font-Size="14pt"
ForeColor="#777777"
Font-Names="Arial,Helvetica"
Font-Italic="True"
Runat="Server" />

<p>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#000000"> <table width="100%" border="0"
cellspacing="0" cellpadding="3">
<tr>
<td width="60%" valign="top" bgcolor="#CC0000">
<table width="423" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="211"> <asp:Label
Text="Year"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:DropDownList
ID="vehicleyear"
Runat="Server">
<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="1950" />
<asp:ListItem Text="1951" />
<asp:ListItem Text="1952" />
<asp:ListItem Text="1953" />
<asp:ListItem Text="1954" />
<asp:ListItem Text="1955" />
<asp:ListItem Text="1956" />
<asp:ListItem Text="1957" />
<asp:ListItem Text="1958" />
<asp:ListItem Text="1959" />
<asp:ListItem Text="1960" />
<asp:ListItem Text="1961" />
<asp:ListItem Text="1962" />
<asp:ListItem Text="1963" />
<asp:ListItem Text="1964" />
<asp:ListItem Text="1965" />
<asp:ListItem Text="1966" />
<asp:ListItem Text="1967" />
<asp:ListItem Text="1968" />
<asp:ListItem Text="1969" />
<asp:ListItem Text="1970" />
<asp:ListItem Text="1971" />
<asp:ListItem Text="1972" />
<asp:ListItem Text="1973" />
<asp:ListItem Text="1974" />
<asp:ListItem Text="1975" />
<asp:ListItem Text="1976" />
<asp:ListItem Text="1977" />
<asp:ListItem Text="1978" />
<asp:ListItem Text="1979" />
<asp:ListItem Text="1980" />
<asp:ListItem Text="1981" />
<asp:ListItem Text="1982" />
<asp:ListItem Text="1983" />
<asp:ListItem Text="1984" />
<asp:ListItem Text="1985" />
<asp:ListItem Text="1986" />
<asp:ListItem Text="1987" />
<asp:ListItem Text="1988" />
<asp:ListItem Text="1989" />
<asp:ListItem Text="1990" />
<asp:ListItem Text="1991" />
<asp:ListItem Text="1992" />
<asp:ListItem Text="1993" />
<asp:ListItem Text="1994" />
<asp:ListItem Text="1995" />
<asp:ListItem Text="1996" />
<asp:ListItem Text="1997" />
<asp:ListItem Text="1998" />
<asp:ListItem Text="1999" />
<asp:ListItem Text="2000" />
<asp:ListItem Text="2001" />
<asp:ListItem Text="2002" />
<asp:ListItem Text="2003" />
<asp:ListItem Text="2004" />
<asp:ListItem Text="2005" />
<asp:ListItem Text="2006" />
</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
ControlToValidate="vehicleyear"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
InitialValue="Please Choose"
ErrorMessage="You must select a vehicle year"
Text="*"
Runat="Server" />

</td>
<td width="212"> <asp:Label
Text="Selling Price"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclesellingprice"
MaxLength="8"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ErrorMessage="Selling price should be entered as 5555 do not enter any
characters other then numbers"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ControlToValidate="vehiclesellingprice"
Text="*"

ValidationExpression="^[^,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ!@#$%^&*.]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="You must enter a selling price"
ControlToValidate="vehiclesellingprice"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Mileage"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclemileage"
MaxLength="8"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ErrorMessage="Vehicle mileage should be entered as 55555 and cannot
contain any characters other than numbers"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ControlToValidate="vehiclemileage"
Text="*"

ValidationExpression="^[^,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ!@#$%^&*.]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="You must include the vehicle mileage"
ControlToValidate="vehiclemileage"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Exterior Color"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleexteriorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Exterior color cannot contain any special characters"
ControlToValidate="vehicleexteriorcolor"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="You must include an exterior color"
ControlToValidate="vehicleexteriorcolor"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Transmission Type"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehicletransmission"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Automatic" />
<asp:ListItem Text="Manual" />

</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="You must include the vehicle transmission type"
InitialValue="Please Choose"
ControlToValidate="vehicletransmission"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Vin Number"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclevinnumber"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="VIN number cannot contain any special characters"
ControlToValidate="vehiclevinnumber"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
ForeColor="#ffffff"
Font-Size="8pt"
ErrorMessage="You must include the vehicle VIN number"
ControlToValidate="vehiclevinnumber"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Stock Number"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclestocknumber"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Stock number cannot contain any special characters. Only
letter and number combinations are accepted"
ControlToValidate="vehiclestocknumber"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Please include a vehicle stock number"
ControlToValidate="vehiclestocknumber"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Warranty Years"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehiclewarrantyyears"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="1" />
<asp:ListItem Text="2" />
<asp:ListItem Text="3" />
<asp:ListItem Text="4" />
<asp:ListItem Text="5" />
<asp:ListItem Text="6" />
<asp:ListItem Text="7" />
<asp:ListItem Text="8" />
<asp:ListItem Text="9" />
<asp:ListItem Text="10" />

</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please select warranty years"
InitialValue="Please Choose"
ControlToValidate="vehiclewarrantyyears"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Warranty Miles"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclewarrantymiles"
MaxLength="8"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Warranty miles must contain only a number with no commas
or periods"
ControlToValidate="vehiclewarrantymiles"
Text="*"

ValidationExpression="^[^,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ!@#$%^&*.]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please include warranty miles"
ControlToValidate="vehiclewarrantymiles"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Engine Type"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleenginetype"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Engine type must not contain any special characters"
ControlToValidate="vehicleenginetype"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please include an engine type"
ControlToValidate="vehicleenginetype"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Body Style"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehiclebodystyle"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Convertible" />
<asp:ListItem Text="Sedan" />
<asp:ListItem Text="Coupe" />
<asp:ListItem Text="SUV" />
<asp:ListItem Text="HatchBack" />
<asp:ListItem Text="Truck" />
<asp:ListItem Text="Mini Van" />
<asp:ListItem Text="Van" />
<asp:ListItem Text="Wagon" />

</asp:DropDownList>


<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Please select a body style"
InitialValue="Please Choose"
ControlToValidate="vehiclebodystyle"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Interior Type"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br>

<asp:DropDownList
ID="vehicleinteriortype"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Fabric" />
<asp:ListItem Text="Leather" />

</asp:DropDownList>
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please select an interior type"
InitialValue="Please Choose"
ControlToValidate="vehicleinteriortype"
Text="*"
Runat="Server" />
</td>
</tr>
<tr>
<td> <asp:Label
Text="Interior Color"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleinteriorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Interior color cannot contain any special characters"
ControlToValidate="vehicleinteriorcolor"
Text="*"
ValidationExpression="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Interior color is required"
ControlToValidate="vehicleinteriorcolor"
Text="*"
Runat="Server" />

</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2">

<asp:Label
Text="Equipment"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" />

<br>
<asp:TextBox
ID="vehicleequipment"
Columns="43"
Rows="7"
TextMode="MultiLine"
MaxLength="1000"
Runat="Server" />

<asp:RegularExpressionValidator
Display="Dynamic"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
ErrorMessage="Vehicle equipment cannot contain any special characters"
ControlToValidate="vehicleequipment"
Text="*"
ValidationExpression="^[^@#^*]*$"
Runat="Server" />
<asp:RequiredFieldValidator
Display="Dynamic"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ErrorMessage="Please include vehicle equipment"
ControlToValidate="vehicleequipment"
Text="*"
Runat="Server" />
<p>

<asp:CheckBox
ID="specialvehicle"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Text="Put this vehicle on special"
Runat="Server" />

<asp:Label
Text="Vehicle Location"
Font-Size="8pt"
ForeColor="#ffffff"
Font-Names="Arial,Helvetica"
Runat="Server" />

<br>
<asp:DropDownList
ID="vehiclelocation"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Kailua Kona" />
<asp:ListItem Text="Hilo" />

</asp:DropDownList>

<asp:RequiredFieldValidator
Display="Dynamic"
ControlToValidate="vehiclelocation"
Font-Names="Arial,Helvetica"
Font-Size="8pt"
ForeColor="#ffffff"
InitialValue="Please Choose"
ErrorMessage="You must select a vehicle location"
Text="*"
Runat="Server" />
</td>
</tr>
</table>

</td>
<td width="40%" valign="top" align="center">

<img src="../images/bigedit.jpg" border="0">
</td>
</tr>
</table>



</td>
</tr>
</table>



<p>
<asp:Button
ID="btnSubmitNoPic"
Text="Update Vehicle"
OnClick="btnSubmitNoPic_Click"
Runat="Server" />






</form>

</td>
</tr>
</table>



<map name="Map">
<area shape="rect" coords="2,1,153,21" href="addvehicle.aspx">
<area shape="rect" coords="155,0,294,32" href="deletevehicle.aspx">
<area shape="rect" coords="295,0,436,28" href="editvehicle.aspx">
<area shape="rect" coords="438,0,580,21" href="imagecenter.aspx">
</map>
</body>
</html>

<%
dtrSiteDetails.Close()
conSiteData.Close()
dtrRowData.Close()
conSelectRow.Close()
%>






Nov 18 '05 #3
I gave a longer answer that might be lost in the ether somewhere. Shorter
version, looks like you're setting SelectedValue of vehiclewarrantyyears
dropdown to "0", but that's not a valid value in the list (there's "please
choose" and "1", but no "0"). Use FindByValue to make sure the entry is in
the list, even when you "know" it should be.

hth,

Bill

Nov 18 '05 #4
My goodness, YOU WERE RIGHT!!!!

I feel like a complete tool lol. Thank you so very much Bill for taking the
time to step through this!

Todd

"Bill Borg" <Bi******@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
I gave a longer answer that might be lost in the ether somewhere. Shorter
version, looks like you're setting SelectedValue of vehiclewarrantyyears
dropdown to "0", but that's not a valid value in the list (there's "please
choose" and "1", but no "0"). Use FindByValue to make sure the entry is in
the list, even when you "know" it should be.

hth,

Bill

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Conroy | last post by:
Hi... Synposis... Throws exception: "Specified argument was out of the range of valid values." Read on for the juicy tidbits. MySimpleClassCol mscc=new MySimpleClassCol(); private void...
9
by: subdhar | last post by:
I'm getting following error in asp.net application.I search the web and couldn't find error like this can any one help me in trouble with this error Specified argument was out of the range of...
0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
0
by: darrel | last post by:
What does this error mean? Specified argument was out of the range of valid values. Parameter name: value System.Web It's being thrown here: DDL_SubCategory.Enabled = True...
0
by: rajarameshvarma | last post by:
Hi.... I have a serious problem while deploying my asp.net application. I have developed a web project in which everypage contains Header, Left navigation and footer as usercontrols. For center...
1
by: IndiraPriyaDarshini | last post by:
Hi , Am trying to sum the total in the footer if a gridview, but am getting the error "Specified argument was out of the range of valid values. Parameter name: index "..Its Printing one cell value...
6
by: rhepsi | last post by:
Hi All... I Came across this error while populating a combobox from a datatable (I'm working in VB.NET): Specified argument was out of the range of valid values. Parameter name: '-1' is not a...
0
by: gsauns | last post by:
I have a DetailsView which is inside of a FormView. I lifted this DetailsView straight off another one of my pages, where it was working beautifully. Now I get this endlessly frustrating error...
2
by: Chapi | last post by:
hi, i'm having problems with a datagrid paging. it's populates fine, but when i click the paging button appears this error:"Specified argument was out of the range of valid values.Parameter name:...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.