Ok. I have a dataset that has multiple tables in it. In one of the child
tables, I have a column that I added to the DataSet (Not in the
DataSource). This column does not need to be stored in the data on the
datasource. It simply gets the first name and last name of an instructor
and displays it in the grid. I have two major problems.... One, it
doesn't display in the column until the row is saved, (Even after
calling a refresh on the grid) and two, I am getting a Cannot change
ReadOnly property of the expression column error message when I try to
update the datasource. I found a lot of confusing information that dealt
with the column updating the datasource, etc etc. The column is in none
of the commands attached to the data adapters.
For the column refresh problem, I added code to manually fill in that
field when leaving a previous column and that seemed to work, however,
it doesn't always show when doing a refresh. I have to navigate back to
that column in order to see it.
Any ideas on either problem?
Aaron
--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks. 6 10623
How did you add the column to the dataset? You added it to the Table? Can
you post some simplified code that shows the problem?
Chris
"Aaron Smith" <th**********@smithcentral.net> wrote in message
news:bb**************@newssvr19.news.prodigy.com.. . Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the data on the datasource. It simply gets the first name and last name of an instructor and displays it in the grid. I have two major problems.... One, it doesn't display in the column until the row is saved, (Even after calling a refresh on the grid) and two, I am getting a Cannot change ReadOnly property of the expression column error message when I try to update the datasource. I found a lot of confusing information that dealt with the column updating the datasource, etc etc. The column is in none of the commands attached to the data adapters.
For the column refresh problem, I added code to manually fill in that field when leaving a previous column and that seemed to work, however, it doesn't always show when doing a refresh. I have to navigate back to that column in order to see it.
Any ideas on either problem? Aaron -- --- Aaron Smith Remove -1- to E-Mail me. Spam Sucks.
I just added it to the Dataset Schema and then set the expression in the
new procedure of the form...
CoursesDS1.InstClasses.FullNameColumn.Expression =
"Parent(InstructorsInstClasses).First_Name + ' ' +
Parent(InstructorsInstClasses).Last_Name"
Thats the expression...
If that is the only line of code in there, and I don't manually set the
value, it still does not work.. I still get the same message. Should I
remove that column from the schema and manually create the column and
add it to the table?? I think I will try that while waiting for other
suggestions.
Aaron
Chris, Master of All Things Insignificant wrote: How did you add the column to the dataset? You added it to the Table? Can you post some simplified code that shows the problem?
Chris
"Aaron Smith" <th**********@smithcentral.net> wrote in message news:bb**************@newssvr19.news.prodigy.com.. .
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the data on the datasource. It simply gets the first name and last name of an instructor and displays it in the grid. I have two major problems.... One, it doesn't display in the column until the row is saved, (Even after calling a refresh on the grid) and two, I am getting a Cannot change ReadOnly property of the expression column error message when I try to update the datasource. I found a lot of confusing information that dealt with the column updating the datasource, etc etc. The column is in none of the commands attached to the data adapters.
For the column refresh problem, I added code to manually fill in that field when leaving a previous column and that seemed to work, however, it doesn't always show when doing a refresh. I have to navigate back to that column in order to see it.
Any ideas on either problem? Aaron -- --- Aaron Smith Remove -1- to E-Mail me. Spam Sucks.
--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.
I'm still getting this error, does anyone have any more ideas? I removed
the field from the schema and manually add it and I still get the error
message. The record actually saves, but this error just pops up.. If
there a way to turn error checking off for certain fields? Is it just a
property I am not setting?
Aaron Smith wrote: I just added it to the Dataset Schema and then set the expression in the new procedure of the form...
CoursesDS1.InstClasses.FullNameColumn.Expression = "Parent(InstructorsInstClasses).First_Name + ' ' + Parent(InstructorsInstClasses).Last_Name"
Thats the expression...
If that is the only line of code in there, and I don't manually set the value, it still does not work.. I still get the same message. Should I remove that column from the schema and manually create the column and add it to the table?? I think I will try that while waiting for other suggestions.
Aaron
Chris, Master of All Things Insignificant wrote:
How did you add the column to the dataset? You added it to the Table? Can you post some simplified code that shows the problem?
Chris
"Aaron Smith" <th**********@smithcentral.net> wrote in message news:bb**************@newssvr19.news.prodigy.com.. .
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the data on the datasource. It simply gets the first name and last name of an instructor and displays it in the grid. I have two major problems.... One, it doesn't display in the column until the row is saved, (Even after calling a refresh on the grid) and two, I am getting a Cannot change ReadOnly property of the expression column error message when I try to update the datasource. I found a lot of confusing information that dealt with the column updating the datasource, etc etc. The column is in none of the commands attached to the data adapters.
For the column refresh problem, I added code to manually fill in that field when leaving a previous column and that seemed to work, however, it doesn't always show when doing a refresh. I have to navigate back to that column in order to see it.
Any ideas on either problem? Aaron -- --- Aaron Smith Remove -1- to E-Mail me. Spam Sucks.
--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.
I fixed this problem. The solution is quite simple. Whenever you call
Update on the dataadapter, just remove the expression and then add it
back after the update is finished:
Dim dc As DataColumn = DataSet.Table.Columns.Item("ExpCol")
Dim exp As String = dc.Expression
dc.Expression = ""
Try
DataAdapter.Update(DataSet, "Table")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message(), "Error")
Finally
dc.Expression = exp
End Try
I tried to just remove the whole column, then add it back in, but for
some reason I was getting an error message that the column wasn't a
datacolumn or datarelation, so I simplified...
Aaron Smith wrote: I'm still getting this error, does anyone have any more ideas? I removed the field from the schema and manually add it and I still get the error message. The record actually saves, but this error just pops up.. If there a way to turn error checking off for certain fields? Is it just a property I am not setting?
Aaron Smith wrote:
I just added it to the Dataset Schema and then set the expression in the new procedure of the form...
CoursesDS1.InstClasses.FullNameColumn.Expression = "Parent(InstructorsInstClasses).First_Name + ' ' + Parent(InstructorsInstClasses).Last_Name"
Thats the expression...
If that is the only line of code in there, and I don't manually set the value, it still does not work.. I still get the same message. Should I remove that column from the schema and manually create the column and add it to the table?? I think I will try that while waiting for other suggestions.
Aaron
Chris, Master of All Things Insignificant wrote:
How did you add the column to the dataset? You added it to the Table? Can you post some simplified code that shows the problem?
Chris
"Aaron Smith" <th**********@smithcentral.net> wrote in message news:bb**************@newssvr19.news.prodigy.com.. .
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the data on the datasource. It simply gets the first name and last name of an instructor and displays it in the grid. I have two major problems.... One, it doesn't display in the column until the row is saved, (Even after calling a refresh on the grid) and two, I am getting a Cannot change ReadOnly property of the expression column error message when I try to update the datasource. I found a lot of confusing information that dealt with the column updating the datasource, etc etc. The column is in none of the commands attached to the data adapters.
For the column refresh problem, I added code to manually fill in that field when leaving a previous column and that seemed to work, however, it doesn't always show when doing a refresh. I have to navigate back to that column in order to see it.
Any ideas on either problem? Aaron -- --- Aaron Smith Remove -1- to E-Mail me. Spam Sucks.
--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.
I was running into the same problem and, based on wht I learned here, decided
to catch and ignore the exception.
Alternative to manually accepting changes at the table level would be to
accept all changes in the dataset at the end of the updates.
Carl
Here is the code snippet:
Try
Me.sdaOrders.Update(inDS.Orders.Select("", "", _
DataViewRowState.Added Or
DataViewRowState.ModifiedCurrent))
Catch RO_exception As Data.ReadOnlyException
' do nothing, need to catch it for the expression column
' DO NOT Accept changes here, more changes to be saved later!
End Try
' can add, change, and delete because no subordinate tables
Me.sdaOrderPayments.Update(inDS.OrderPayments)
' only add or modify, can't delete because there are subordinate
tables
Me.sdaOrderDetails.Update(inDS.OrderDetails.Select ("", "", _
DataViewRowState.Added Or DataViewRowState.ModifiedCurrent))
' can add, change, and delete because no subordinate tables
Me.sdaOrderMiscCharges.Update(inDS.OrderDetailMisc Charges)
' only add or modify, can't delete because there are subordinate
tables
Me.sdaOrderDetailComponents.Update(inDS.OrderDetai lComponents.Select("", "", _
DataViewRowState.Added Or DataViewRowState.ModifiedCurrent))
' can add, change, and delete because no subordinate tables
Me.sdaOrderDetailComponentSpeficiations.Update(inD S.OrderDetailComponentSpecifications)
' now pick up the deletes, from the bottom up
Me.sdaOrderDetailComponents.Update(inDS.OrderDetai lComponents)
Me.sdaOrderDetails.Update(inDS.OrderDetails)
Try
Me.sdaOrders.Update(inDS.Orders)
Catch RO_exception As Data.ReadOnlyException
' accept changes manually and continue
inDS.Orders.AcceptChanges()
End Try
"Aaron Smith" wrote: I fixed this problem. The solution is quite simple. Whenever you call Update on the dataadapter, just remove the expression and then add it back after the update is finished:
Dim dc As DataColumn = DataSet.Table.Columns.Item("ExpCol") Dim exp As String = dc.Expression dc.Expression = "" Try DataAdapter.Update(DataSet, "Table") Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.Message(), "Error") Finally dc.Expression = exp End Try
I tried to just remove the whole column, then add it back in, but for some reason I was getting an error message that the column wasn't a datacolumn or datarelation, so I simplified...
Aaron Smith wrote: I'm still getting this error, does anyone have any more ideas? I removed the field from the schema and manually add it and I still get the error message. The record actually saves, but this error just pops up.. If there a way to turn error checking off for certain fields? Is it just a property I am not setting?
Aaron Smith wrote:
I just added it to the Dataset Schema and then set the expression in the new procedure of the form...
CoursesDS1.InstClasses.FullNameColumn.Expression = "Parent(InstructorsInstClasses).First_Name + ' ' + Parent(InstructorsInstClasses).Last_Name"
Thats the expression...
If that is the only line of code in there, and I don't manually set the value, it still does not work.. I still get the same message. Should I remove that column from the schema and manually create the column and add it to the table?? I think I will try that while waiting for other suggestions.
Aaron
Chris, Master of All Things Insignificant wrote:
How did you add the column to the dataset? You added it to the Table? Can you post some simplified code that shows the problem?
Chris
"Aaron Smith" <th**********@smithcentral.net> wrote in message news:bb**************@newssvr19.news.prodigy.com.. .
> Ok. I have a dataset that has multiple tables in it. In one of the > child tables, I have a column that I added to the DataSet (Not in > the DataSource). This column does not need to be stored in the data > on the datasource. It simply gets the first name and last name of an > instructor and displays it in the grid. I have two major > problems.... One, it doesn't display in the column until the row is > saved, (Even after calling a refresh on the grid) and two, I am > getting a Cannot change ReadOnly property of the expression column > error message when I try to update the datasource. I found a lot of > confusing information that dealt with the column updating the > datasource, etc etc. The column is in none of the commands attached > to the data adapters. > > For the column refresh problem, I added code to manually fill in > that field when leaving a previous column and that seemed to work, > however, it doesn't always show when doing a refresh. I have to > navigate back to that column in order to see it. > > Any ideas on either problem? > Aaron > -- > --- > Aaron Smith > Remove -1- to E-Mail me. Spam Sucks.
-- --- Aaron Smith Remove -1- to E-Mail me. Spam Sucks.
OK, well, that solution wasn't quite as solid as I thought yesterday. I was
just hiding the problem. After more research apparently this is a known bug
since 2002 although I can find no reference to it when searching the MS KB.
There is a nice little writeup on it with workarounds at www.falafel.com/flogs
I chose to drop the expression columns, do the update, and restore them.
Simply setting the expression to empty or Nothing raised an "instance of
object not set" exception. Still needs more testing but it appears to get
around the problem. Since I have a separate data access layer I do it at
that level avoiding the problems (I think!) with dropping the columns and
databinding.
Carl
Here is a simple code snippet:
' save expression columns and delete them out so updates will go
through
Dim dcLastNameFirstExp As DataColumn =
inDS.Customer.Columns("LastNameFirst")
Dim dcCityStateZipExp As DataColumn =
inDS.Customer.Columns("CityStateZip")
inDS.Customer.Columns.Remove("LastNameFirst")
inDS.Customer.Columns.Remove("CityStateZip")
' save customer changes and additions
Me.sdaCustomer.Update(inDS.Customer.Select("", "", _
DataViewRowState.Added Or DataViewRowState.ModifiedCurrent))
' save all phone number changes, including deletes
Me.sdaPhoneNumber.Update(inDS.CustomerPhoneNumber)
' process customer deletes
Me.sdaCustomer.Update(inDS.Customer)
"clorentson" wrote: I was running into the same problem and, based on wht I learned here, decided to catch and ignore the exception.
Alternative to manually accepting changes at the table level would be to accept all changes in the dataset at the end of the updates.
Carl
Here is the code snippet:
Try Me.sdaOrders.Update(inDS.Orders.Select("", "", _ DataViewRowState.Added Or DataViewRowState.ModifiedCurrent)) Catch RO_exception As Data.ReadOnlyException ' do nothing, need to catch it for the expression column ' DO NOT Accept changes here, more changes to be saved later! End Try ' can add, change, and delete because no subordinate tables Me.sdaOrderPayments.Update(inDS.OrderPayments)
' only add or modify, can't delete because there are subordinate tables Me.sdaOrderDetails.Update(inDS.OrderDetails.Select ("", "", _ DataViewRowState.Added Or DataViewRowState.ModifiedCurrent)) ' can add, change, and delete because no subordinate tables Me.sdaOrderMiscCharges.Update(inDS.OrderDetailMisc Charges) ' only add or modify, can't delete because there are subordinate tables
Me.sdaOrderDetailComponents.Update(inDS.OrderDetai lComponents.Select("", "", _ DataViewRowState.Added Or DataViewRowState.ModifiedCurrent)) ' can add, change, and delete because no subordinate tables
Me.sdaOrderDetailComponentSpeficiations.Update(inD S.OrderDetailComponentSpecifications)
' now pick up the deletes, from the bottom up Me.sdaOrderDetailComponents.Update(inDS.OrderDetai lComponents) Me.sdaOrderDetails.Update(inDS.OrderDetails) Try Me.sdaOrders.Update(inDS.Orders) Catch RO_exception As Data.ReadOnlyException ' accept changes manually and continue inDS.Orders.AcceptChanges() End Try
"Aaron Smith" wrote:
I fixed this problem. The solution is quite simple. Whenever you call Update on the dataadapter, just remove the expression and then add it back after the update is finished:
Dim dc As DataColumn = DataSet.Table.Columns.Item("ExpCol") Dim exp As String = dc.Expression dc.Expression = "" Try DataAdapter.Update(DataSet, "Table") Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.Message(), "Error") Finally dc.Expression = exp End Try
I tried to just remove the whole column, then add it back in, but for some reason I was getting an error message that the column wasn't a datacolumn or datarelation, so I simplified...
Aaron Smith wrote: I'm still getting this error, does anyone have any more ideas? I removed the field from the schema and manually add it and I still get the error message. The record actually saves, but this error just pops up.. If there a way to turn error checking off for certain fields? Is it just a property I am not setting?
Aaron Smith wrote:
> I just added it to the Dataset Schema and then set the expression in > the new procedure of the form... > > CoursesDS1.InstClasses.FullNameColumn.Expression = > "Parent(InstructorsInstClasses).First_Name + ' ' + > Parent(InstructorsInstClasses).Last_Name" > > Thats the expression... > > If that is the only line of code in there, and I don't manually set > the value, it still does not work.. I still get the same message. > Should I remove that column from the schema and manually create the > column and add it to the table?? I think I will try that while waiting > for other suggestions. > > Aaron > > Chris, Master of All Things Insignificant wrote: > >> How did you add the column to the dataset? You added it to the >> Table? Can you post some simplified code that shows the problem? >> >> Chris >> >> "Aaron Smith" <th**********@smithcentral.net> wrote in message >> news:bb**************@newssvr19.news.prodigy.com.. . >> >>> Ok. I have a dataset that has multiple tables in it. In one of the >>> child tables, I have a column that I added to the DataSet (Not in >>> the DataSource). This column does not need to be stored in the data >>> on the datasource. It simply gets the first name and last name of an >>> instructor and displays it in the grid. I have two major >>> problems.... One, it doesn't display in the column until the row is >>> saved, (Even after calling a refresh on the grid) and two, I am >>> getting a Cannot change ReadOnly property of the expression column >>> error message when I try to update the datasource. I found a lot of >>> confusing information that dealt with the column updating the >>> datasource, etc etc. The column is in none of the commands attached >>> to the data adapters. >>> >>> For the column refresh problem, I added code to manually fill in >>> that field when leaving a previous column and that seemed to work, >>> however, it doesn't always show when doing a refresh. I have to >>> navigate back to that column in order to see it. >>> >>> Any ideas on either problem? >>> Aaron >>> -- >>> --- >>> Aaron Smith >>> Remove -1- to E-Mail me. Spam Sucks. >> >> >> >> >> > >
-- --- Aaron Smith Remove -1- to E-Mail me. Spam Sucks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: woodpecker |
last post by:
when I set the datagrid's readonly=true,I can't set it back to false
value,why?
Anybody can tell me the reason?
Thanks your help.
Woodpecker.
|
by: Marcin Floryan |
last post by:
I am creating a custom control (Inherits UserControl) and my control
containt a TextBox control. TextBox control has a Property called
"ReadOnly". I would like to expose this property outside my...
|
by: Dany P. Wu |
last post by:
Hi everyone,
I'm not entirely sure if this is the best way of going about it, but here's
the scenario..........
I have two datagrid, each bound to a datatable which have checkbox columns....
|
by: mike11d11 |
last post by:
Can anyone Tell me why this code doesnt let me bind a Textbox field to
the Account# column in my SQL table. It says "Cannot bind to the
property or column ACCOUNT# on the DataSource.
Parameter...
|
by: Ajit Goel |
last post by:
Hi;
My project file property is set to use "Visual Studio Development
Server". I am able to debug and see the corresponding values when I
mouseover but as soon as I change to the project file...
|
by: Don Lancaster |
last post by:
I need to progrmatically do this inside a loop
this.fh03.value = fixFloat (Harms, numPoints) ;
with the numbers changing per an index.
If I try
curHvals = "03" ; // (derived from...
|
by: Adem |
last post by:
C/C++ language proposal:
Change the 'case expression' from "integral constant-expression" to "integral expression"
The C++ Standard (ISO/IEC 14882, Second edition, 2003-10-15)
says under...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |