I'm getting a server error in .net 2.0

Joined
Jan 19, 2010
Messages
2
Reaction score
0
I'm new to programming in .Net 2.0. I'm getting an error and can't find anything wrong in my code. I've tried rewriting it from scratch but got the same error:
Server Error in '/Kalibreringscertificat' Application.
--------------------------------------------------------------------------------

Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
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.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.]
System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args) +2865311
System.String.Format(IFormatProvider provider, String format, Object[] args) +91
System.Web.UI.WebControls.FilteredDataSetHelper.CreateFilteredDataView(DataTable table, String sortExpression, String filterExpression, IDictionary filterParameters) +395
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +3370
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +84
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +153
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99
System.Web.UI.WebControls.DetailsView.DataBind() +23
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +92
System.Web.UI.WebControls.DetailsView.EnsureDataBound() +196
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +100
System.Web.UI.Control.EnsureChildControls() +134
System.Web.UI.Control.PreRenderRecursiveInternal() +109
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4421




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1873; ASP.NET Version:2.0.50727.1433

Here is my code:
Code:
<table style="border-right: black thin solid; border-top: black thin solid; border-left: black thin solid; border-bottom: black thin solid;">
    <tr>
        <td>
        </td>
        <td style="text-align: center">
            <table>
                <tr>
                    <td colspan="2" style="text-align: center; width: 407px;">Skapa skjutmatt</td>
                </tr>
                <tr>
	                <td colspan="2" style="text-align: center; height: 26px; width: 407px;">
                        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
                            DataTextField="Skjutmatt" DataValueField="SkId" AutoPostBack="True" Width="400px">
                        </asp:DropDownList>&nbsp;</td>
                </tr>
                
                <tr>
	                <td colspan="2" style="text-align: center; width: 407px;">
                        &nbsp;<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1" Height="50px" Width="125px" AutoGenerateEditButton="True" DefaultMode="Insert" BorderColor="#999999" BackColor="White" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical">
                            <Fields>
                                <asp:BoundField DataField="Skjutmatt" HeaderText="Skjutmatt" SortExpression="Skjutmatt" />
                                <asp:BoundField DataField="Serienr" HeaderText="Serienr" SortExpression="Serienr" />
                                <asp:BoundField DataField="Upplosning" HeaderText="Upplosning" SortExpression="Upplosning" />
                                <asp:BoundField DataField="Matprecision" HeaderText="Matprecision" SortExpression="Matprecision" />
                                <asp:BoundField DataField="Matosakerhet" HeaderText="Matosakerhet"
                                    SortExpression="Matosakerhet" />
                                <asp:CommandField ButtonType="Button" CancelText="Avbryt" InsertText="Inmatning"
                                    ShowInsertButton="True" />
                                <asp:BoundField DataField="SkId" HeaderText="SkId" InsertVisible="False" ReadOnly="True"
                                    SortExpression="SkId" Visible="False" />
                            </Fields>
                            <FooterStyle BackColor="#CCCCCC" />
                            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="#CCCCCC" />
                        </asp:DetailsView>
	                </td>
                </tr>
            </table>
            <asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label></td>
    </tr>
</table>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
    SelectCommand="SELECT * FROM [Skjutm] WHERE [IsAktiv] " ConflictDetection="CompareAllValues" InsertCommand="INSERT INTO Skjutm([Skjutmatt], [Serienr], [Upplosning], [Matprecision], [Matosakerhet], [IsAktiv]) VALUES (@Skjutmatt, @Serienr, @Upplosning, @Matprecision, @Matosakerhet, True)">
</asp:SqlDataSource>

I can read from the table from another web page. (I added a post by hand into the access database.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,037
Messages
2,570,371
Members
47,013
Latest member
JewellChes

Latest Threads

Top