capito...
diciamo che per ora preferisco il mio metodo perchè mi è un pò più chiaro.
poi proverò anche il tuo.
ho però un problema:
codice:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1">
<Columns>
<asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="Length" />
<asp:BoundField DataField="entrate" HeaderText="Entrate" ReadOnly="True" SortExpression="Length" />
<asp:BoundField DataField="uscite" HeaderText="Escite" ReadOnly="True" SortExpression="Length" />
<asp:BoundField DataField="causale" HeaderText="Causale" ReadOnly="True" SortExpression="Length" />
<asp:BoundField DataField="data" HeaderText="Data" ReadOnly="True" SortExpression="Length" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="getMoves"
TypeName="Matteo.Class1"></asp:ObjectDataSource>
mi restituisce una pagina di errore che nn capisco:
codice:
A field or property with the name 'id' was not found on the selected data source.
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.Web.HttpException: A field or property with the name 'id' was not found on the selected data source.
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:
[HttpException (0x80004005): A field or property with the name 'id' was not found on the selected data source.]
System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer) +1763899
System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e) +67
System.Web.UI.Control.OnDataBinding(EventArgs e) +91
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +92
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +201
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
System.Web.UI.Control.DataBind() +15
System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +166
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +3896
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +66
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
System.Web.UI.Control.EnsureChildControls() +102
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
il codice per la connessione al db è quello sopra.
quello che nn capisco è se sbaglio nella connessione o nel gridview.
fatto sta che i campi di quel db sono quelli.