Hi guys,<BR><BR>I&#039;ve had code in asp.net thats worked no problems for selected the database value of a radio when the field in the database is a nvarchar or varchar. However now i&#039;m using integers and bits to store the values i&#039;m having problems. <BR><BR>Here is the code:<BR><BR>&#060;%@ Page Language="VB" aspcompat="true" Debug="true" ValidateRequest="false" %&#062;<BR>&#060;%@ Import Namespace="System.Data" %&#062;<BR>&#060;%@ Import Namespace="System.Data.SQLClient" %&#062;<BR>&#060;%@ Import Namespace="System.Data.OleDb" %&#062;<BR>&#060;script language="VB" runat="server"&#062;<BR>Sub Page_Load(Source as Object, E as EventArgs)<BR><BR> &#039;Dim nowDate As Date = now<BR> &#039;startDate.text = nowDate<BR> <BR><BR> If Page.IsPostBack Then<BR><BR> if headline.text = "" OR author.text = "" OR summary.text = "" OR article.text = "" then<BR> MSG.text = "Please fill the form ..."<BR> else <BR><BR> Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))<BR> Dim InsertCommand As SqlCommand = New SqlCommand()<BR> InsertCommand.Connection = cnn<BR> Dim sql As String<BR> sql = "Update newsarticles set headline = @headline, author = @author, startDate = @startDate, endDate = @endDate, summary = @summary, article = @article, publish = @publish, ranking = @ranking"<BR> sql += " Where articleID = " & request.querystring("articleID")<BR> InsertCommand.CommandText = sql<BR><BR> InsertCommand.Parameters.Add("@headline", SqlDbType.NVarChar, 150).Value = headline.text<BR> InsertCommand.Parameters.Add("@author", SqlDbType.NVarChar, 90).Value = author.text<BR> InsertCommand.Parameters.Add("@startDate", SqlDbType.DateTime).Value = startDate.text<BR> InsertCommand.Parameters.Add("@endDate", SqlDbType.DateTime).Value = endDate.text<BR> InsertCommand.Parameters.Add("@summary", SqlDbType.NVarChar, 450).Value = summary.text<BR> InsertCommand.Parameters.Add("@article", SqlDbType.Ntext).Value = article.text<BR> InsertCommand.Parameters.Add("@publish", SqlDbType.bit).Value = publish.SelectedValue.Trim()<BR> InsertCommand.Parameters.Add("@ranking", SqlDbType.bit).Value = ranking.SelectedValue.Trim()<BR><BR> Try<BR> cnn.Open()<BR> InsertCommand.ExecuteNonQuery()<BR> MSG.text = "Your article has been updated ..."<BR> Catch ex As Exception<BR> MSG.text = ex.ToString()<BR><BR> Finally<BR> cnn.Close()<BR> End Try<BR> end if<BR> else<BR><BR> Dim MyConn as New SQLConnection(ConfigurationSettings.AppSettings("c onnectionString"))<BR><BR> MyConn.Open<BR><BR> dim sql as string = "select * from newsarticles where articleID = " & request.querystring("articleID")<BR> <BR> Dim cmd As new SQLCommand (sql, MyConn)<BR><BR> dim r as SQLDataReader<BR> r = cmd.ExecuteReader<BR> dim strArticle as string = "<BR>"<BR><BR> r.read()<BR> headline.text = r("headline")<BR> summary.text = r("summary")<BR> startDate.text = r("startDate")<BR> endDate.text = r("endDate")<BR> article.Text = r("article")<BR> author.text = r("author")<BR> publish.SelectedValue = r("publish")<BR> ranking.SelectedValue = r("ranking")<BR> r.close()<BR> MyConn.Close()<BR> end if<BR> end sub<BR><BR>&#060;/script&#062;<BR><BR><BR>Here is the error:<BR><BR>Server Error in &#039;/&#039; Application.<BR>--------------------------------------------------------------------------------<BR><BR>Specified argument was out of the range of valid values. Parameter name: True <BR>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. <BR><BR>Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: True<BR><BR>Source Error: <BR><BR><BR>Line 65: article.Text = r("article")<BR>Line 66: author.text = r("author")<BR>Line 67: publish.SelectedValue = r("publish")<BR>Line 68: ranking.SelectedValue = r("ranking")<BR>Line 69: r.close()<BR> <BR><BR>Source File: C:InetpubwebsitesWebsite 2005admin
ewsedit.aspx Line: 67 <BR><BR>Stack Trace: <BR><BR><BR>[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.<BR>Parameter name: True]<BR> System.Web.UI.WebControls.ListControl.set_Selected Value(String value) +152<BR> ASP.edit_aspx.Page_Load(Object Source, EventArgs E) in C:InetpubwebsitesVersant Website 2005admin
ewsedit.aspx:67<BR> System.Web.UI.Control.OnLoad(EventArgs e) +67<BR> System.Web.UI.Control.LoadRecursive() +35<BR> System.Web.UI.Page.ProcessRequestMain() +750<BR><BR> <BR><BR><BR>--------------------------------------------------------------------------------<BR>Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032 <BR><BR><BR>Can anyone shed any light on what i&#039;m doing wrong here. My radio code is like so:<BR><BR>&#060;asp:RadioButtonList ID="publish" runat="server" RepeatDirection="Horizontal"&#062;<BR> &#060;asp:ListItem value="1"&#062;ON&#060;/asp:ListItem&#062;<BR> &#060;asp:ListItem value="0"&#062;OFF&#060;/asp:ListItem&#062;<BR> &#060;/asp:RadioButtonList&#062;<BR><BR>Thanks as always<BR><BR>James<BR>