Monday, March 12, 2012

Why this error when table has this column name

I know my table has this column but I keep getting the following error doesn't make sense: (my code for the for the button is below the error)

Column 'CompanyID' does not belong to table Categories.

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.ArgumentException: Column 'CompanyID' does not belong to table Categories.
Source Error:
Line 883: Dim row As DataRowLine 884: row = DsPerformanceTabStrip1.Categories.NewCategoriesRowLine 885: row("CompanyID") = Session("companyID")Line 886: row("FacilityID") = Session("facilityID")Line 887: row("PeriodID") = Session("Period")

PrivateSub btnCatAdd_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles btnCatAdd.Click

DsPerformanceTabStrip1.Clear()

SqlDataAdapter1.SelectCommand.Parameters("@dotnet.itags.org.Period").Value = ddlEvalPeriod.SelectedValue

SqlDataAdapter1.Fill(DsPerformanceTabStrip1)

Dim rowAs DataRow

row = DsPerformanceTabStrip1.Categories.NewCategoriesRow

row("CompanyID") = Session("companyID")

row("FacilityID") = Session("facilityID")

row("PeriodID") = Session("Period")

row("SeqNbr") = txtSeq.Text

row("Description") = txtDescription.Text

DsPerformanceTabStrip1.Categories.AddCategoriesRow(row)

SqlDataAdapter1.Update(DsPerformanceTabStrip1)

DsPerformanceTabStrip1.Clear()

SqlDataAdapter1.Fill(DsPerformanceTabStrip1)

dgCategoryCurrent.DataBind()

EndSub

I found my answer -- I wasn't calling these columns in my stored procedure--I had the wrong stored procedure in my dataadapter

0 comments:

Post a Comment