webForumDet fria alternativet

Vad göra? med: A field or property with the name 'ActivityID' was not found...

.NET

1 svar · 705 visningar · startad av T_Codez

Medlem sedan juli 2001458 inlägg
Frågan#1

Vad göra med detta!?

[B]A field or property with the name 'ActivityID' was not found on the selected datasource. [/B] 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 'ActivityID' was not found on the selected datasource.

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 'ActivityID' was not found on the selected datasource.]
   System.Web.UI.WebControls.BoundColumn.OnDataBindColumn(Object sender, EventArgs e) +348
   System.Web.UI.Control.OnDataBinding(EventArgs e) +66
   System.Web.UI.Control.DataBind() +26
   System.Web.UI.Control.DataBind() +86
   System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource) +169
   System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) +1408
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +48
   System.Web.UI.WebControls.BaseDataList.DataBind() +23
   TBServer.Region_default11.dropDownAktivitet_SelectedIndexChanged(Object sender, EventArgs e) in Y:\Inetpub\wwwroot\site\region\functions\sch\default.aspx.vb:888
   System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +108
   System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +26
   System.Web.UI.Page.RaiseChangedEvents() +115
   System.Web.UI.Page.ProcessRequestMain() +1099

Hur kommer jag förbi detta felmess? Har provat så många varianter nu, så jag knappt vet vad jag heter... Just dont get it! :bla :(

Jag är övertygad om att det är fel på propertyn i datagriden iom att fältet finns i tabellen. Jag har ett ColumnName: Aktivitet och till den har jag ett Datafield: ActivityID (en integer)

Miljö:
SQL2000
VS2003
Vers. 1.1

Alla uppslag är välkomna

Medlem sedan juli 2001458 inlägg
#2

Hittade felet... :birp

Ibland såräker det med att skriva hit...

hade:
dt.Columns.Add(New DataColumn("AktivityID", GetType(String)))

som ska vara:
dt.Columns.Add(New DataColumn("ActivityID", GetType(String)))

*suck*
Varför är det alltid de enklaste felen som är svårast att hitta?

Tack för uppmärksamheten iaf. :e

260 ms totalt · 4 externa anrop · v20260731065814-full.86ec41c2
127 ms — deklarationer (db)
0 ms — hämta statistik (cache)
129 ms — hämta tråd, inlägg och bilagor (db)
128 ms — ändringar (db)