473,543 Members | 2,311 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Argument OutOfRangeExcep tion: 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
vehiclewarranty years - 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="Syst em.Data" %>
<%@ Import Namespace="Syst em.Web" %>
<%@ Import Namespace="Syst em.IO" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<%@ Import Namespace="Syst em.Drawing.Imag ing" %>
<%
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.Ope n()
cmdSelectAll = New SqlCommand( "SELECT * FROM sitedata",conSi teData )
dtrSiteDetails = cmdSelectAll.Ex ecuteReader()
dtrSiteDetails. Read()
conSelectRow = New SqlConnection( "server info here" )
conSelectRow.Op en()
cmdSelectRow = New SqlCommand( "SELECT * FROM vehicles WHERE ID=" &
Request.QuerySt ring("ID"), conSelectRow )
dtrRowData = cmdSelectRow.Ex ecuteReader()
dtrRowData.Read ()

If dtrRowData.HasR ows = False Then
Session("error" ) = "true"
Response.Redire ct( "editvehicle.as px" )
End If
vehiclelocation .SelectedValue = dtrRowData("veh iclelocation"). ToString()
vehicleyear.Sel ectedValue = dtrRowData("veh icleyear").ToSt ring()
vehiclesellingp rice.Text =
FormatNumber(dt rRowData("vehic lesellingprice" ).ToString(), 0,,,false)
vehiclemileage. Text = FormatNumber(dt rRowData("vehic lemileage").ToS tring(),
0,,,false)
vehicleexterior color.Text = dtrRowData("veh icleexteriorcol or").ToString ()
vehicletransmis sion.SelectedVa lue =
dtrRowData("veh icletransmissio n").ToString ()
vehiclevinnumbe r.Text = dtrRowData("veh iclevinnumber") .ToString()
vehiclestocknum ber.Text = dtrRowData("veh iclestocknumber ").ToString ()

vehiclewarranty years.SelectedV alue =
dtrRowData("veh iclewarrantyyea rs").ToString ()

vehiclewarranty miles.Text =
FormatNumber(dt rRowData("vehic lewarrantymiles ").ToString (), 0,,,false)
vehicleenginety pe.Text = dtrRowData("veh icleenginetype" ).ToString()
vehiclebodystyl e.SelectedValue = dtrRowData("veh iclebodystyle") .ToString()
vehicleinterior type.SelectedVa lue =
dtrRowData("veh icleinteriortyp e").ToString ()
vehicleinterior color.Text = dtrRowData("veh icleinteriorcol or").ToString ()
vehicleequipmen t.Text = dtrRowData("veh icleequipment") .ToString()

Dim strSpecial As String
strSpecial = dtrRowData("spe cialvehicle")

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

lblManu.Text = dtrRowData("veh iclemanufacture r").ToString ()
lblModel.Text = dtrRowData("veh iclemodel").ToS tring()

%>
<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;da tabase=uvims_ho ndaofhawaii" )

strUpdate = "Update vehicles Set vehiclelocation =@vehiclelocati on,
vehicleyear=@ve hicleyear, vehiclesellingp rice=@vehiclese llingprice,
vehiclemileage= @vehiclemileage , vehicleexterior color=@vehiclee xteriorcolor,
vehicletransmis sion=@vehicletr ansmission,
vehiclevinnumbe r=@vehiclevinnu mber, vehiclestocknum ber=@vehiclesto cknumber,
vehiclewarranty years=@vehiclew arrantyyears,
vehiclewarranty miles=@vehiclew arrantymiles,
vehicleenginety pe=@vehicleengi netype, vehiclebodystyl e=@vehiclebodys tyle,
vehicleequipmen t=@vehicleequip ment,
vehicleinterior type=@vehiclein teriortype,
vehicleinterior color=@vehiclei nteriorcolor, specialvehicle= @specialvehicle
WHERE ID=" & Request.QuerySt ring("ID")
cmdUpdate = New SqlCommand( strUpdate, conMyCn )

cmdUpdate.Param eters.Add( "@vehiclelocati on",
vehiclelocation .SelectedValue )
cmdUpdate.Param eters.Add( "@vehicleye ar", SqlDbType.Int ).Value =
vehicleyear.Sel ectedItem.Value
cmdUpdate.Param eters.Add( "@vehiclesellin gprice", SqlDbType.Money ).Value =
vehiclesellingp rice.Text
cmdUpdate.Param eters.Add( "@vehiclemileag e", SqlDbType.Int ).Value =
vehiclemileage. Text
cmdUpdate.Param eters.Add( "@vehicleexteri orcolor",
vehicleexterior color.Text )
cmdUpdate.Param eters.Add( "@vehicletransm ission",
vehicletransmis sion.SelectedIt em.Value )
cmdUpdate.Param eters.Add( "@vehiclevinnum ber", vehiclevinnumbe r.Text )
cmdUpdate.Param eters.Add( "@vehiclestockn umber", vehiclestocknum ber.Text )

cmdUpdate.Param eters.Add( "@vehiclewarran tyyears", SqlDbType.Int ).Value =
vehiclewarranty years.SelectedI tem.Value


cmdUpdate.Param eters.Add( "@vehiclewarran tymiles", SqlDbType.Int ).Value =
vehiclewarranty miles.Text
cmdUpdate.Param eters.Add( "@vehicleengine type", vehicleenginety pe.Text )
cmdUpdate.Param eters.Add( "@vehiclebodyst yle",
vehiclebodystyl e.SelectedItem. Value )
cmdUpdate.Param eters.Add( "@vehicleequipm ent", vehicleequipmen t.Text )
cmdUpdate.Param eters.Add( "@vehicleinteri ortype",
vehicleinterior type.SelectedIt em.Value )
cmdUpdate.Param eters.Add( "@vehicleinteri orcolor",
vehicleinterior color.Text )
If specialvehicle. Checked Then
cmdUpdate.Param eters.Add( "@specialvehicl e", SqlDbType.Int ).Value = 1
Else
cmdUpdate.Param eters.Add( "@specialvehicl e", SqlDbType.Int ).Value = 0
End If

conMyCn.Open()
cmdUpdate.Execu teNonQuery()
conMyCn.Close()

Session("succes s") = "true"
Response.Redire ct( "editvehicle.as px" )
End If
End Sub



</SCRIPT>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><%=(dtrS iteDetails("sit epagetitles"))% ></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta NAME="keywords" CONTENT="<%=(dt rSiteDetails("s itemetakeywords "))%>">
<meta NAME="descripti on"
CONTENT="<%=(dt rSiteDetails("s itemetadescript ion"))%>">

</head>

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

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

<td bgcolor="#00000 0"><img src="../images/admin_navigatio n.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="#F7F7F 7">

<img src="../images/headereditvehic le2.jpg">

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

<p>

<form EncType="multip art/form-data" Runat="Server">

<asp:Validation Summary
HeaderText="The re are problems within the form."
DisplayMode="Bu lletList"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
Runat="Server" />

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

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

<p>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#00000 0"> <table width="100%" border="0" cellspacing="0"
cellpadding="3" >
<tr>
<td width="60%" valign="top" bgcolor="#CC000 0">
<table width="423" border="0" cellspacing="0"
cellpadding="0" >
<tr>
<td width="211"> <asp:Label
Text="Year"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:DropDownLi st
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:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
ControlToValida te="vehicleyear "
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
InitialValue="P lease Choose"
ErrorMessage="Y ou must select a vehicle year"
Text="*"
Runat="Server" />

</td>
<td width="212"> <asp:Label
Text="Selling Price"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclesell ingprice"
MaxLength="8"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ErrorMessage="S elling price should be entered as 5555 do not enter any
characters other then numbers"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ControlToValida te="vehiclesell ingprice"
Text="*"
ValidationExpre ssion="^[^,abcdefghijklm nopqrstuvwxyzAB CDEFGHIJKLMNOPQ RSTUVWXYZ!@#$%^ &*.]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="Y ou must enter a selling price"
ControlToValida te="vehiclesell ingprice"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Mileage"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclemile age"
MaxLength="8"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ErrorMessage="V ehicle mileage should be entered as 55555 and cannot
contain any characters other than numbers"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ControlToValida te="vehiclemile age"
Text="*"
ValidationExpre ssion="^[^,abcdefghijklm nopqrstuvwxyzAB CDEFGHIJKLMNOPQ RSTUVWXYZ!@#$%^ &*.]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="Y ou must include the vehicle mileage"
ControlToValida te="vehiclemile age"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Exterior Color"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleexte riorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="E xterior color cannot contain any special characters"
ControlToValida te="vehicleexte riorcolor"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="Y ou must include an exterior color"
ControlToValida te="vehicleexte riorcolor"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Transmiss ion Type"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br>

<asp:DropDownLi st
ID="vehicletran smission"
Runat="Server">

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

</asp:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="Y ou must include the vehicle transmission type"
InitialValue="P lease Choose"
ControlToValida te="vehicletran smission"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Vin Number"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclevinn umber"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="V IN number cannot contain any special characters"
ControlToValida te="vehiclevinn umber"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
ForeColor="#fff fff"
Font-Size="8pt"
ErrorMessage="Y ou must include the vehicle VIN number"
ControlToValida te="vehiclevinn umber"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Stock Number"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclestoc knumber"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="S tock number cannot contain any special characters. Only
letter and number combinations are accepted"
ControlToValida te="vehiclestoc knumber"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="P lease include a vehicle stock number"
ControlToValida te="vehiclestoc knumber"
Text="*"
Runat="Server" />

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

<asp:DropDownLi st
ID="vehiclewarr antyyears"
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:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease select warranty years"
InitialValue="P lease Choose"
ControlToValida te="vehiclewarr antyyears"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Warranty Miles"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclewarr antymiles"
MaxLength="8"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="W arranty miles must contain only a number with no commas or
periods"
ControlToValida te="vehiclewarr antymiles"
Text="*"
ValidationExpre ssion="^[^,abcdefghijklm nopqrstuvwxyzAB CDEFGHIJKLMNOPQ RSTUVWXYZ!@#$%^ &*.]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease include warranty miles"
ControlToValida te="vehiclewarr antymiles"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Engine Type"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleengi netype"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="E ngine type must not contain any special characters"
ControlToValida te="vehicleengi netype"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease include an engine type"
ControlToValida te="vehicleengi netype"
Text="*"
Runat="Server" />

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

<asp:DropDownLi st
ID="vehiclebody style"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Convertib le" />
<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:DropDownLis t>


<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="P lease select a body style"
InitialValue="P lease Choose"
ControlToValida te="vehiclebody style"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Interior Type"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br>

<asp:DropDownLi st
ID="vehicleinte riortype"
Runat="Server">

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

</asp:DropDownLis t>
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease select an interior type"
InitialValue="P lease Choose"
ControlToValida te="vehicleinte riortype"
Text="*"
Runat="Server" />
</td>
</tr>
<tr>
<td> <asp:Label
Text="Interior Color"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleinte riorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="I nterior color cannot contain any special characters"
ControlToValida te="vehicleinte riorcolor"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="I nterior color is required"
ControlToValida te="vehicleinte riorcolor"
Text="*"
Runat="Server" />

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

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

<br>
<asp:TextBox
ID="vehicleequi pment"
Columns="43"
Rows="7"
TextMode="Multi Line"
MaxLength="1000 "
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="V ehicle equipment cannot contain any special characters"
ControlToValida te="vehicleequi pment"
Text="*"
ValidationExpre ssion="^[^@#^*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease include vehicle equipment"
ControlToValida te="vehicleequi pment"
Text="*"
Runat="Server" />
<p>

<asp:CheckBox
ID="specialvehi cle"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Text="Put this vehicle on special"
Runat="Server" />

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

<br>
<asp:DropDownLi st
ID="vehicleloca tion"
Runat="Server">

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

</asp:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
ControlToValida te="vehicleloca tion"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
InitialValue="P lease Choose"
ErrorMessage="Y ou 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="btnSubmitNo Pic"
Text="Update Vehicle"
OnClick="btnSub mitNoPic_Click"
Runat="Server" />






</form>

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



<map name="Map">
<area shape="rect" coords="2,1,153 ,21" href="addvehicl e.aspx">
<area shape="rect" coords="155,0,2 94,32" href="deleteveh icle.aspx">
<area shape="rect" coords="295,0,4 36,28" href="editvehic le.aspx">
<area shape="rect" coords="438,0,5 80,21" href="imagecent er.aspx">
</map>
</body>
</html>

<%
dtrSiteDetails. Close()
conSiteData.Clo se()
dtrRowData.Clos e()
conSelectRow.Cl ose()
%>





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

Thanks!

"Todd Perkins" <to**@static9.c om> wrote in message
news:pZ******** ***********@big news5.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.Argument OutOfRangeExcep tion: 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
vehiclewarranty years - 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="Syst em.Data" %>
<%@ Import Namespace="Syst em.Web" %>
<%@ Import Namespace="Syst em.IO" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<%@ Import Namespace="Syst em.Drawing.Imag ing" %>
<%
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.Ope n()
cmdSelectAll = New SqlCommand( "SELECT * FROM sitedata",conSi teData )
dtrSiteDetails = cmdSelectAll.Ex ecuteReader()
dtrSiteDetails. Read()
conSelectRow = New SqlConnection( "server info here" )
conSelectRow.Op en()
cmdSelectRow = New SqlCommand( "SELECT * FROM vehicles WHERE ID=" &
Request.QuerySt ring("ID"), conSelectRow )
dtrRowData = cmdSelectRow.Ex ecuteReader()
dtrRowData.Read ()

If dtrRowData.HasR ows = False Then
Session("error" ) = "true"
Response.Redire ct( "editvehicle.as px" )
End If
vehiclelocation .SelectedValue = dtrRowData("veh iclelocation"). ToString()
vehicleyear.Sel ectedValue = dtrRowData("veh icleyear").ToSt ring()
vehiclesellingp rice.Text =
FormatNumber(dt rRowData("vehic lesellingprice" ).ToString(), 0,,,false)
vehiclemileage. Text =
FormatNumber(dt rRowData("vehic lemileage").ToS tring(), 0,,,false)
vehicleexterior color.Text = dtrRowData("veh icleexteriorcol or").ToString ()
vehicletransmis sion.SelectedVa lue =
dtrRowData("veh icletransmissio n").ToString ()
vehiclevinnumbe r.Text = dtrRowData("veh iclevinnumber") .ToString()
vehiclestocknum ber.Text = dtrRowData("veh iclestocknumber ").ToString ()

vehiclewarranty years.SelectedV alue =
dtrRowData("veh iclewarrantyyea rs").ToString ()

vehiclewarranty miles.Text =
FormatNumber(dt rRowData("vehic lewarrantymiles ").ToString (), 0,,,false)
vehicleenginety pe.Text = dtrRowData("veh icleenginetype" ).ToString()
vehiclebodystyl e.SelectedValue = dtrRowData("veh iclebodystyle") .ToString()
vehicleinterior type.SelectedVa lue =
dtrRowData("veh icleinteriortyp e").ToString ()
vehicleinterior color.Text = dtrRowData("veh icleinteriorcol or").ToString ()
vehicleequipmen t.Text = dtrRowData("veh icleequipment") .ToString()

Dim strSpecial As String
strSpecial = dtrRowData("spe cialvehicle")

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

lblManu.Text = dtrRowData("veh iclemanufacture r").ToString ()
lblModel.Text = dtrRowData("veh iclemodel").ToS tring()

%>
<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;da tabase=uvims_ho ndaofhawaii" )

strUpdate = "Update vehicles Set vehiclelocation =@vehiclelocati on,
vehicleyear=@ve hicleyear, vehiclesellingp rice=@vehiclese llingprice,
vehiclemileage= @vehiclemileage ,
vehicleexterior color=@vehiclee xteriorcolor,
vehicletransmis sion=@vehicletr ansmission,
vehiclevinnumbe r=@vehiclevinnu mber,
vehiclestocknum ber=@vehiclesto cknumber,
vehiclewarranty years=@vehiclew arrantyyears,
vehiclewarranty miles=@vehiclew arrantymiles,
vehicleenginety pe=@vehicleengi netype, vehiclebodystyl e=@vehiclebodys tyle,
vehicleequipmen t=@vehicleequip ment,
vehicleinterior type=@vehiclein teriortype,
vehicleinterior color=@vehiclei nteriorcolor, specialvehicle= @specialvehicle
WHERE ID=" & Request.QuerySt ring("ID")
cmdUpdate = New SqlCommand( strUpdate, conMyCn )

cmdUpdate.Param eters.Add( "@vehiclelocati on",
vehiclelocation .SelectedValue )
cmdUpdate.Param eters.Add( "@vehicleye ar", SqlDbType.Int ).Value =
vehicleyear.Sel ectedItem.Value
cmdUpdate.Param eters.Add( "@vehiclesellin gprice", SqlDbType.Money ).Value
= vehiclesellingp rice.Text
cmdUpdate.Param eters.Add( "@vehiclemileag e", SqlDbType.Int ).Value =
vehiclemileage. Text
cmdUpdate.Param eters.Add( "@vehicleexteri orcolor",
vehicleexterior color.Text )
cmdUpdate.Param eters.Add( "@vehicletransm ission",
vehicletransmis sion.SelectedIt em.Value )
cmdUpdate.Param eters.Add( "@vehiclevinnum ber", vehiclevinnumbe r.Text )
cmdUpdate.Param eters.Add( "@vehiclestockn umber", vehiclestocknum ber.Text )

cmdUpdate.Param eters.Add( "@vehiclewarran tyyears", SqlDbType.Int ).Value =
vehiclewarranty years.SelectedI tem.Value


cmdUpdate.Param eters.Add( "@vehiclewarran tymiles", SqlDbType.Int ).Value =
vehiclewarranty miles.Text
cmdUpdate.Param eters.Add( "@vehicleengine type", vehicleenginety pe.Text )
cmdUpdate.Param eters.Add( "@vehiclebodyst yle",
vehiclebodystyl e.SelectedItem. Value )
cmdUpdate.Param eters.Add( "@vehicleequipm ent", vehicleequipmen t.Text )
cmdUpdate.Param eters.Add( "@vehicleinteri ortype",
vehicleinterior type.SelectedIt em.Value )
cmdUpdate.Param eters.Add( "@vehicleinteri orcolor",
vehicleinterior color.Text )
If specialvehicle. Checked Then
cmdUpdate.Param eters.Add( "@specialvehicl e", SqlDbType.Int ).Value = 1
Else
cmdUpdate.Param eters.Add( "@specialvehicl e", SqlDbType.Int ).Value = 0
End If

conMyCn.Open()
cmdUpdate.Execu teNonQuery()
conMyCn.Close()

Session("succes s") = "true"
Response.Redire ct( "editvehicle.as px" )
End If
End Sub



</SCRIPT>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><%=(dtrS iteDetails("sit epagetitles"))% ></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta NAME="keywords" CONTENT="<%=(dt rSiteDetails("s itemetakeywords "))%>">
<meta NAME="descripti on"
CONTENT="<%=(dt rSiteDetails("s itemetadescript ion"))%>">

</head>

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

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

<td bgcolor="#00000 0"><img src="../images/admin_navigatio n.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="#F7F7F 7">

<img src="../images/headereditvehic le2.jpg">

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

<p>

<form EncType="multip art/form-data" Runat="Server">

<asp:Validation Summary
HeaderText="The re are problems within the form."
DisplayMode="Bu lletList"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
Runat="Server" />

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

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

<p>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#00000 0"> <table width="100%" border="0" cellspacing="0"
cellpadding="3" >
<tr>
<td width="60%" valign="top" bgcolor="#CC000 0">
<table width="423" border="0" cellspacing="0"
cellpadding="0" >
<tr>
<td width="211"> <asp:Label
Text="Year"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:DropDownLi st
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:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
ControlToValida te="vehicleyear "
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
InitialValue="P lease Choose"
ErrorMessage="Y ou must select a vehicle year"
Text="*"
Runat="Server" />

</td>
<td width="212"> <asp:Label
Text="Selling Price"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclesell ingprice"
MaxLength="8"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ErrorMessage="S elling price should be entered as 5555 do not enter any
characters other then numbers"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ControlToValida te="vehiclesell ingprice"
Text="*"

ValidationExpre ssion="^[^,abcdefghijklm nopqrstuvwxyzAB CDEFGHIJKLMNOPQ RSTUVWXYZ!@#$%^ &*.]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="Y ou must enter a selling price"
ControlToValida te="vehiclesell ingprice"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Mileage"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclemile age"
MaxLength="8"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ErrorMessage="V ehicle mileage should be entered as 55555 and cannot
contain any characters other than numbers"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ControlToValida te="vehiclemile age"
Text="*"

ValidationExpre ssion="^[^,abcdefghijklm nopqrstuvwxyzAB CDEFGHIJKLMNOPQ RSTUVWXYZ!@#$%^ &*.]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="Y ou must include the vehicle mileage"
ControlToValida te="vehiclemile age"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Exterior Color"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleexte riorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="E xterior color cannot contain any special characters"
ControlToValida te="vehicleexte riorcolor"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="Y ou must include an exterior color"
ControlToValida te="vehicleexte riorcolor"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Transmiss ion Type"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br>

<asp:DropDownLi st
ID="vehicletran smission"
Runat="Server">

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

</asp:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="Y ou must include the vehicle transmission type"
InitialValue="P lease Choose"
ControlToValida te="vehicletran smission"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Vin Number"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclevinn umber"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="V IN number cannot contain any special characters"
ControlToValida te="vehiclevinn umber"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
ForeColor="#fff fff"
Font-Size="8pt"
ErrorMessage="Y ou must include the vehicle VIN number"
ControlToValida te="vehiclevinn umber"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Stock Number"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclestoc knumber"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="S tock number cannot contain any special characters. Only
letter and number combinations are accepted"
ControlToValida te="vehiclestoc knumber"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="P lease include a vehicle stock number"
ControlToValida te="vehiclestoc knumber"
Text="*"
Runat="Server" />

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

<asp:DropDownLi st
ID="vehiclewarr antyyears"
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:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease select warranty years"
InitialValue="P lease Choose"
ControlToValida te="vehiclewarr antyyears"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Warranty Miles"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclewarr antymiles"
MaxLength="8"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="W arranty miles must contain only a number with no commas
or periods"
ControlToValida te="vehiclewarr antymiles"
Text="*"

ValidationExpre ssion="^[^,abcdefghijklm nopqrstuvwxyzAB CDEFGHIJKLMNOPQ RSTUVWXYZ!@#$%^ &*.]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease include warranty miles"
ControlToValida te="vehiclewarr antymiles"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Engine Type"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleengi netype"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="E ngine type must not contain any special characters"
ControlToValida te="vehicleengi netype"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease include an engine type"
ControlToValida te="vehicleengi netype"
Text="*"
Runat="Server" />

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

<asp:DropDownLi st
ID="vehiclebody style"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Convertib le" />
<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:DropDownLis t>


<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="P lease select a body style"
InitialValue="P lease Choose"
ControlToValida te="vehiclebody style"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Interior Type"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br>

<asp:DropDownLi st
ID="vehicleinte riortype"
Runat="Server">

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

</asp:DropDownLis t>
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease select an interior type"
InitialValue="P lease Choose"
ControlToValida te="vehicleinte riortype"
Text="*"
Runat="Server" />
</td>
</tr>
<tr>
<td> <asp:Label
Text="Interior Color"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleinte riorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="I nterior color cannot contain any special characters"
ControlToValida te="vehicleinte riorcolor"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="I nterior color is required"
ControlToValida te="vehicleinte riorcolor"
Text="*"
Runat="Server" />

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

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

<br>
<asp:TextBox
ID="vehicleequi pment"
Columns="43"
Rows="7"
TextMode="Multi Line"
MaxLength="1000 "
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="V ehicle equipment cannot contain any special characters"
ControlToValida te="vehicleequi pment"
Text="*"
ValidationExpre ssion="^[^@#^*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease include vehicle equipment"
ControlToValida te="vehicleequi pment"
Text="*"
Runat="Server" />
<p>

<asp:CheckBox
ID="specialvehi cle"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Text="Put this vehicle on special"
Runat="Server" />

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

<br>
<asp:DropDownLi st
ID="vehicleloca tion"
Runat="Server">

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

</asp:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
ControlToValida te="vehicleloca tion"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
InitialValue="P lease Choose"
ErrorMessage="Y ou 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="btnSubmitNo Pic"
Text="Update Vehicle"
OnClick="btnSub mitNoPic_Click"
Runat="Server" />






</form>

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



<map name="Map">
<area shape="rect" coords="2,1,153 ,21" href="addvehicl e.aspx">
<area shape="rect" coords="155,0,2 94,32" href="deleteveh icle.aspx">
<area shape="rect" coords="295,0,4 36,28" href="editvehic le.aspx">
<area shape="rect" coords="438,0,5 80,21" href="imagecent er.aspx">
</map>
</body>
</html>

<%
dtrSiteDetails. Close()
conSiteData.Clo se()
dtrRowData.Clos e()
conSelectRow.Cl ose()
%>





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**@NOSPAMsta tic9.com> wrote in message
news:Ja******** ***********@big news5.bellsouth .net...
I should also say that the error only appears to be happening when
vehiclewarrant yyear field has a value of 0 in the database.

Thanks!

"Todd Perkins" <to**@static9.c om> wrote in message
news:pZ******** ***********@big news5.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.Argument OutOfRangeExcep tion: 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 vehiclewarranty years - 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="Syst em.Data" %>
<%@ Import Namespace="Syst em.Web" %>
<%@ Import Namespace="Syst em.IO" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<%@ Import Namespace="Syst em.Drawing.Imag ing" %>
<%
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.Ope n()
cmdSelectAll = New SqlCommand( "SELECT * FROM sitedata",conSi teData )
dtrSiteDetails = cmdSelectAll.Ex ecuteReader()
dtrSiteDetails. Read()
conSelectRow = New SqlConnection( "server info here" )
conSelectRow.Op en()
cmdSelectRow = New SqlCommand( "SELECT * FROM vehicles WHERE ID=" &
Request.QuerySt ring("ID"), conSelectRow )
dtrRowData = cmdSelectRow.Ex ecuteReader()
dtrRowData.Read ()

If dtrRowData.HasR ows = False Then
Session("error" ) = "true"
Response.Redire ct( "editvehicle.as px" )
End If
vehiclelocation .SelectedValue = dtrRowData("veh iclelocation"). ToString()
vehicleyear.Sel ectedValue = dtrRowData("veh icleyear").ToSt ring()
vehiclesellingp rice.Text =
FormatNumber(dt rRowData("vehic lesellingprice" ).ToString(), 0,,,false)
vehiclemileage. Text =
FormatNumber(dt rRowData("vehic lemileage").ToS tring(), 0,,,false)
vehicleexterior color.Text = dtrRowData("veh icleexteriorcol or").ToString ()
vehicletransmis sion.SelectedVa lue =
dtrRowData("veh icletransmissio n").ToString ()
vehiclevinnumbe r.Text = dtrRowData("veh iclevinnumber") .ToString()
vehiclestocknum ber.Text = dtrRowData("veh iclestocknumber ").ToString ()

vehiclewarranty years.SelectedV alue =
dtrRowData("veh iclewarrantyyea rs").ToString ()

vehiclewarranty miles.Text =
FormatNumber(dt rRowData("vehic lewarrantymiles ").ToString (), 0,,,false)
vehicleenginety pe.Text = dtrRowData("veh icleenginetype" ).ToString()
vehiclebodystyl e.SelectedValue =
dtrRowData("veh iclebodystyle") .ToString()
vehicleinterior type.SelectedVa lue =
dtrRowData("veh icleinteriortyp e").ToString ()
vehicleinterior color.Text = dtrRowData("veh icleinteriorcol or").ToString ()
vehicleequipmen t.Text = dtrRowData("veh icleequipment") .ToString()

Dim strSpecial As String
strSpecial = dtrRowData("spe cialvehicle")

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

lblManu.Text = dtrRowData("veh iclemanufacture r").ToString ()
lblModel.Text = dtrRowData("veh iclemodel").ToS tring()

%>
<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;da tabase=uvims_ho ndaofhawaii"
)

strUpdate = "Update vehicles Set vehiclelocation =@vehiclelocati on,
vehicleyear=@ve hicleyear, vehiclesellingp rice=@vehiclese llingprice,
vehiclemileage= @vehiclemileage ,
vehicleexterior color=@vehiclee xteriorcolor,
vehicletransmis sion=@vehicletr ansmission,
vehiclevinnumbe r=@vehiclevinnu mber,
vehiclestocknum ber=@vehiclesto cknumber,
vehiclewarranty years=@vehiclew arrantyyears,
vehiclewarranty miles=@vehiclew arrantymiles,
vehicleenginety pe=@vehicleengi netype, vehiclebodystyl e=@vehiclebodys tyle,
vehicleequipmen t=@vehicleequip ment,
vehicleinterior type=@vehiclein teriortype,
vehicleinterior color=@vehiclei nteriorcolor,
specialvehicle= @specialvehicle WHERE ID=" & Request.QuerySt ring("ID")
cmdUpdate = New SqlCommand( strUpdate, conMyCn )

cmdUpdate.Param eters.Add( "@vehiclelocati on",
vehiclelocation .SelectedValue )
cmdUpdate.Param eters.Add( "@vehicleye ar", SqlDbType.Int ).Value =
vehicleyear.Sel ectedItem.Value
cmdUpdate.Param eters.Add( "@vehiclesellin gprice", SqlDbType.Money ).Value
= vehiclesellingp rice.Text
cmdUpdate.Param eters.Add( "@vehiclemileag e", SqlDbType.Int ).Value =
vehiclemileage. Text
cmdUpdate.Param eters.Add( "@vehicleexteri orcolor",
vehicleexterior color.Text )
cmdUpdate.Param eters.Add( "@vehicletransm ission",
vehicletransmis sion.SelectedIt em.Value )
cmdUpdate.Param eters.Add( "@vehiclevinnum ber", vehiclevinnumbe r.Text )
cmdUpdate.Param eters.Add( "@vehiclestockn umber",
vehiclestocknum ber.Text )

cmdUpdate.Param eters.Add( "@vehiclewarran tyyears", SqlDbType.Int ).Value
= vehiclewarranty years.SelectedI tem.Value


cmdUpdate.Param eters.Add( "@vehiclewarran tymiles", SqlDbType.Int ).Value
= vehiclewarranty miles.Text
cmdUpdate.Param eters.Add( "@vehicleengine type", vehicleenginety pe.Text )
cmdUpdate.Param eters.Add( "@vehiclebodyst yle",
vehiclebodystyl e.SelectedItem. Value )
cmdUpdate.Param eters.Add( "@vehicleequipm ent", vehicleequipmen t.Text )
cmdUpdate.Param eters.Add( "@vehicleinteri ortype",
vehicleinterior type.SelectedIt em.Value )
cmdUpdate.Param eters.Add( "@vehicleinteri orcolor",
vehicleinterior color.Text )
If specialvehicle. Checked Then
cmdUpdate.Param eters.Add( "@specialvehicl e", SqlDbType.Int ).Value = 1
Else
cmdUpdate.Param eters.Add( "@specialvehicl e", SqlDbType.Int ).Value = 0
End If

conMyCn.Open()
cmdUpdate.Execu teNonQuery()
conMyCn.Close()

Session("succes s") = "true"
Response.Redire ct( "editvehicle.as px" )
End If
End Sub



</SCRIPT>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><%=(dtrS iteDetails("sit epagetitles"))% ></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta NAME="keywords"
CONTENT="<%=(dt rSiteDetails("s itemetakeywords "))%>">
<meta NAME="descripti on"
CONTENT="<%=(dt rSiteDetails("s itemetadescript ion"))%>">

</head>

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

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

<td bgcolor="#00000 0"><img src="../images/admin_navigatio n.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="#F7F7F 7">

<img src="../images/headereditvehic le2.jpg">

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

<p>

<form EncType="multip art/form-data" Runat="Server">

<asp:Validation Summary
HeaderText="The re are problems within the form."
DisplayMode="Bu lletList"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
Runat="Server" />

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

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

<p>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#00000 0"> <table width="100%" border="0"
cellspacing="0" cellpadding="3" >
<tr>
<td width="60%" valign="top" bgcolor="#CC000 0">
<table width="423" border="0" cellspacing="0"
cellpadding="0" >
<tr>
<td width="211"> <asp:Label
Text="Year"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:DropDownLi st
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:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
ControlToValida te="vehicleyear "
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
InitialValue="P lease Choose"
ErrorMessage="Y ou must select a vehicle year"
Text="*"
Runat="Server" />

</td>
<td width="212"> <asp:Label
Text="Selling Price"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclesell ingprice"
MaxLength="8"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ErrorMessage="S elling price should be entered as 5555 do not enter any
characters other then numbers"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ControlToValida te="vehiclesell ingprice"
Text="*"

ValidationExpre ssion="^[^,abcdefghijklm nopqrstuvwxyzAB CDEFGHIJKLMNOPQ RSTUVWXYZ!@#$%^ &*.]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="Y ou must enter a selling price"
ControlToValida te="vehiclesell ingprice"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Mileage"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclemile age"
MaxLength="8"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ErrorMessage="V ehicle mileage should be entered as 55555 and cannot
contain any characters other than numbers"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ControlToValida te="vehiclemile age"
Text="*"

ValidationExpre ssion="^[^,abcdefghijklm nopqrstuvwxyzAB CDEFGHIJKLMNOPQ RSTUVWXYZ!@#$%^ &*.]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="Y ou must include the vehicle mileage"
ControlToValida te="vehiclemile age"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Exterior Color"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleexte riorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="E xterior color cannot contain any special characters"
ControlToValida te="vehicleexte riorcolor"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="Y ou must include an exterior color"
ControlToValida te="vehicleexte riorcolor"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Transmiss ion Type"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br>

<asp:DropDownLi st
ID="vehicletran smission"
Runat="Server">

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

</asp:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="Y ou must include the vehicle transmission type"
InitialValue="P lease Choose"
ControlToValida te="vehicletran smission"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Vin Number"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclevinn umber"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="V IN number cannot contain any special characters"
ControlToValida te="vehiclevinn umber"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
ForeColor="#fff fff"
Font-Size="8pt"
ErrorMessage="Y ou must include the vehicle VIN number"
ControlToValida te="vehiclevinn umber"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Stock Number"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclestoc knumber"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="S tock number cannot contain any special characters. Only
letter and number combinations are accepted"
ControlToValida te="vehiclestoc knumber"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="P lease include a vehicle stock number"
ControlToValida te="vehiclestoc knumber"
Text="*"
Runat="Server" />

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

<asp:DropDownLi st
ID="vehiclewarr antyyears"
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:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease select warranty years"
InitialValue="P lease Choose"
ControlToValida te="vehiclewarr antyyears"
Text="*"
Runat="Server" />

</td>
</tr>
<tr>
<td> <asp:Label
Text="Warranty Miles"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehiclewarr antymiles"
MaxLength="8"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="W arranty miles must contain only a number with no commas
or periods"
ControlToValida te="vehiclewarr antymiles"
Text="*"

ValidationExpre ssion="^[^,abcdefghijklm nopqrstuvwxyzAB CDEFGHIJKLMNOPQ RSTUVWXYZ!@#$%^ &*.]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease include warranty miles"
ControlToValida te="vehiclewarr antymiles"
Text="*"
Runat="Server" />

</td>
<td> <asp:Label
Text="Engine Type"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleengi netype"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="E ngine type must not contain any special characters"
ControlToValida te="vehicleengi netype"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease include an engine type"
ControlToValida te="vehicleengi netype"
Text="*"
Runat="Server" />

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

<asp:DropDownLi st
ID="vehiclebody style"
Runat="Server">

<asp:ListItem Text="Please Choose" />
<asp:ListItem Text="Convertib le" />
<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:DropDownLis t>


<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="P lease select a body style"
InitialValue="P lease Choose"
ControlToValida te="vehiclebody style"
Text="*"
Runat="Server" />
</td>
<td> <asp:Label
Text="Interior Type"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br>

<asp:DropDownLi st
ID="vehicleinte riortype"
Runat="Server">

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

</asp:DropDownLis t>
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease select an interior type"
InitialValue="P lease Choose"
ControlToValida te="vehicleinte riortype"
Text="*"
Runat="Server" />
</td>
</tr>
<tr>
<td> <asp:Label
Text="Interior Color"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Runat="Server" /> <br> <asp:TextBox
ID="vehicleinte riorcolor"
MaxLength="250"
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="I nterior color cannot contain any special characters"
ControlToValida te="vehicleinte riorcolor"
Text="*"
ValidationExpre ssion="^[^!@#$%^&*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="I nterior color is required"
ControlToValida te="vehicleinte riorcolor"
Text="*"
Runat="Server" />

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

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

<br>
<asp:TextBox
ID="vehicleequi pment"
Columns="43"
Rows="7"
TextMode="Multi Line"
MaxLength="1000 "
Runat="Server" />

<asp:RegularExp ressionValidato r
Display="Dynami c"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
ErrorMessage="V ehicle equipment cannot contain any special characters"
ControlToValida te="vehicleequi pment"
Text="*"
ValidationExpre ssion="^[^@#^*]*$"
Runat="Server" />
<asp:RequiredFi eldValidator
Display="Dynami c"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ErrorMessage="P lease include vehicle equipment"
ControlToValida te="vehicleequi pment"
Text="*"
Runat="Server" />
<p>

<asp:CheckBox
ID="specialvehi cle"
Font-Size="8pt"
ForeColor="#fff fff"
Font-Names="Arial,He lvetica"
Text="Put this vehicle on special"
Runat="Server" />

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

<br>
<asp:DropDownLi st
ID="vehicleloca tion"
Runat="Server">

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

</asp:DropDownLis t>

<asp:RequiredFi eldValidator
Display="Dynami c"
ControlToValida te="vehicleloca tion"
Font-Names="Arial,He lvetica"
Font-Size="8pt"
ForeColor="#fff fff"
InitialValue="P lease Choose"
ErrorMessage="Y ou 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="btnSubmitNo Pic"
Text="Update Vehicle"
OnClick="btnSub mitNoPic_Click"
Runat="Server" />






</form>

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



<map name="Map">
<area shape="rect" coords="2,1,153 ,21" href="addvehicl e.aspx">
<area shape="rect" coords="155,0,2 94,32" href="deleteveh icle.aspx">
<area shape="rect" coords="295,0,4 36,28" href="editvehic le.aspx">
<area shape="rect" coords="438,0,5 80,21" href="imagecent er.aspx">
</map>
</body>
</html>

<%
dtrSiteDetails. Close()
conSiteData.Clo se()
dtrRowData.Clos e()
conSelectRow.Cl ose()
%>






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 vehiclewarranty years
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******@discu ssions.microsof t.com> wrote in message
news:8F******** *************** ***********@mic rosoft.com...
I gave a longer answer that might be lost in the ether somewhere. Shorter
version, looks like you're setting SelectedValue of vehiclewarranty years
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
3469
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 InitCombo() {
9
5799
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 valid values. Parameter name: U Description: An unhandled exception occurred during the execution of the current web request. Please review the stack...
0
4786
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 manually inserted a row in the table bound to the Combo box. The InsertAt Method of adding a row just does not work. Hope this helps anyone with...
0
1390
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 DDL_SubCategory.DataSource = DS
0
3491
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 court i have used Ifrmae tag to call an HTML page. It was working fine for most of the pages it is working fine. But for some pages...user controls...
1
2610
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 in the footer.. But for the seond sum,it showing the error, the value is getting, Help me pls.. Here is the ode snippent
6
3675
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 valid value for 'index'
0
1519
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 message whenever I try to go into Edit mode: Specified argument was out of the range of valid values. Parameter name: index The DetailsView is...
2
3079
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: index" I paste the code here in case someone can help me. Sub paginaNueva(ByVal sender As Object, ByVal e As...
0
7582
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7726
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5257
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4884
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3384
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3385
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1809
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
948
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
626
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.