HI ,
I have the following code snippet in a function
******************************************************
Try
Dim YearDataset As ADODatasets.YearDataset = Nothing
Dim StartYear As String = String.Empty
Dim EndYear As String = String.Empty
Dim Position As Integer = 0
StartYear = CStr(Year(Now) - 12)
EndYear = CStr(Year(Now))
Dim YearTable As New
AODNETMiscellaneous.Business.YearTable(StartYear, EndYear)
YearDataset = YearTable.YearDataset
Dim myDataRow As DataRow = YearDataset.Year.NewRow
myDataRow("YearID") = 0
myDataRow("Year") = "None"
Position = YearDataset.Year.Rows.Count
YearDataset.Year.Rows.InsertAt(myDataRow, Position)
Return YearDataset.Year
Catch ex As Exception
Throw
Finally
End Try
*************************************************
Basically this retuns a year dataset and I use that dataset to bind to
dropdown in the front in .aspx page. As you see a datarow is being
added to the returned dataset at the bottom for the users to be able
to select "None" if they prefer to.
But now that we have a requirement to add "NA" in addition to the
"None" I am just trying to do the same way as above.. trying to add
another datarow to the dataset as shown below
myDataRow("YearID") = -1
myDataRow("Year") = "NA"
Position = YearDataset.Year.Rows.Count
YearDataset.Year.Rows.InsertAt(myDataRow, Position)
but it is throwing "Column is read only" error.
Can some one help me what must be causing this error to happen?
Thanks,
L
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---