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 10679
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**********@s mithcentral.net > wrote in message
news:bb******** ******@newssvr1 9.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.Inst Classes.FullNam eColumn.Express ion =
"Parent(Instruc torsInstClasses ).First_Name + ' ' +
Parent(Instruct orsInstClasses) .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**********@s mithcentral.net > wrote in message news:bb******** ******@newssvr1 9.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.Inst Classes.FullNam eColumn.Express ion = "Parent(Instruc torsInstClasses ).First_Name + ' ' + Parent(Instruct orsInstClasses) .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**********@s mithcentral.net > wrote in message news:bb******** ******@newssvr1 9.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.C olumns.Item("Ex pCol")
Dim exp As String = dc.Expression
dc.Expression = ""
Try
DataAdapter.Upd ate(DataSet, "Table")
Catch ex As Exception
System.Windows. Forms.MessageBo x.Show(ex.Messa ge(),"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.Inst Classes.FullNam eColumn.Express ion = "Parent(Instruc torsInstClasses ).First_Name + ' ' + Parent(Instruct orsInstClasses) .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**********@s mithcentral.net > wrote in message news:bb******** ******@newssvr1 9.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.Up date(inDS.Order s.Select("", "", _
DataViewRowStat e.Added Or
DataViewRowStat e.ModifiedCurre nt))
Catch RO_exception As Data.ReadOnlyEx ception
' 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.sdaOrderPaym ents.Update(inD S.OrderPayments )
' only add or modify, can't delete because there are subordinate
tables
Me.sdaOrderDeta ils.Update(inDS .OrderDetails.S elect("", "", _
DataViewRowStat e.Added Or DataViewRowStat e.ModifiedCurre nt))
' can add, change, and delete because no subordinate tables
Me.sdaOrderMisc Charges.Update( inDS.OrderDetai lMiscCharges)
' only add or modify, can't delete because there are subordinate
tables
Me.sdaOrderDeta ilComponents.Up date(inDS.Order DetailComponent s.Select("", "", _
DataViewRowStat e.Added Or DataViewRowStat e.ModifiedCurre nt))
' can add, change, and delete because no subordinate tables
Me.sdaOrderDeta ilComponentSpef iciations.Updat e(inDS.OrderDet ailComponentSpe cifications)
' now pick up the deletes, from the bottom up
Me.sdaOrderDeta ilComponents.Up date(inDS.Order DetailComponent s)
Me.sdaOrderDeta ils.Update(inDS .OrderDetails)
Try
Me.sdaOrders.Up date(inDS.Order s)
Catch RO_exception As Data.ReadOnlyEx ception
' accept changes manually and continue
inDS.Orders.Acc eptChanges()
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.C olumns.Item("Ex pCol") Dim exp As String = dc.Expression dc.Expression = "" Try DataAdapter.Upd ate(DataSet, "Table") Catch ex As Exception System.Windows. Forms.MessageBo x.Show(ex.Messa ge(),"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.Inst Classes.FullNam eColumn.Express ion = "Parent(Instruc torsInstClasses ).First_Name + ' ' + Parent(Instruct orsInstClasses) .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**********@s mithcentral.net > wrote in message news:bb******** ******@newssvr1 9.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 dcLastNameFirst Exp As DataColumn =
inDS.Customer.C olumns("LastNam eFirst")
Dim dcCityStateZipE xp As DataColumn =
inDS.Customer.C olumns("CitySta teZip")
inDS.Customer.C olumns.Remove(" LastNameFirst")
inDS.Customer.C olumns.Remove(" CityStateZip")
' save customer changes and additions
Me.sdaCustomer. Update(inDS.Cus tomer.Select("" , "", _
DataViewRowStat e.Added Or DataViewRowStat e.ModifiedCurre nt))
' save all phone number changes, including deletes
Me.sdaPhoneNumb er.Update(inDS. CustomerPhoneNu mber)
' process customer deletes
Me.sdaCustomer. Update(inDS.Cus tomer)
"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.Up date(inDS.Order s.Select("", "", _ DataViewRowStat e.Added Or DataViewRowStat e.ModifiedCurre nt)) Catch RO_exception As Data.ReadOnlyEx ception ' 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.sdaOrderPaym ents.Update(inD S.OrderPayments )
' only add or modify, can't delete because there are subordinate tables Me.sdaOrderDeta ils.Update(inDS .OrderDetails.S elect("", "", _ DataViewRowStat e.Added Or DataViewRowStat e.ModifiedCurre nt)) ' can add, change, and delete because no subordinate tables Me.sdaOrderMisc Charges.Update( inDS.OrderDetai lMiscCharges) ' only add or modify, can't delete because there are subordinate tables
Me.sdaOrderDeta ilComponents.Up date(inDS.Order DetailComponent s.Select("", "", _ DataViewRowStat e.Added Or DataViewRowStat e.ModifiedCurre nt)) ' can add, change, and delete because no subordinate tables
Me.sdaOrderDeta ilComponentSpef iciations.Updat e(inDS.OrderDet ailComponentSpe cifications)
' now pick up the deletes, from the bottom up Me.sdaOrderDeta ilComponents.Up date(inDS.Order DetailComponent s) Me.sdaOrderDeta ils.Update(inDS .OrderDetails) Try Me.sdaOrders.Up date(inDS.Order s) Catch RO_exception As Data.ReadOnlyEx ception ' accept changes manually and continue inDS.Orders.Acc eptChanges() 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.C olumns.Item("Ex pCol") Dim exp As String = dc.Expression dc.Expression = "" Try DataAdapter.Upd ate(DataSet, "Table") Catch ex As Exception System.Windows. Forms.MessageBo x.Show(ex.Messa ge(),"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.Inst Classes.FullNam eColumn.Express ion = > "Parent(Instruc torsInstClasses ).First_Name + ' ' + > Parent(Instruct orsInstClasses) .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**********@s mithcentral.net > wrote in message >> news:bb******** ******@newssvr1 9.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 own control, but
it seems impossible because when I write:
Public Property ReadOnly() as Boolean
....
The compilter treats ReadOnly as a Modifier and does not allow this
contruct. Can I expose a property of my control under a different name...
|
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.
There are two buttons between the datagrids, "Add" and "Remove". They
basically remove rows from one grid to the other, only those with the
checkbox ticked.
|
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 name: dataMember" I've been looking around and some people
have been using the currency manager. If this is a solution could
someone show me how I can add it to my code to make my binding work
correctly. thanks
Public Class Form1
|
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 property to use
"IIS web server", I am unable to see the mouseover value.When I add a
watch, I get the following error "Cannot evaluate expression because the
code of the current method is optimized". I am sure its something I am
not doing right...
| |
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 index to provide leading zero)
|
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 6.4.2(2) :
case constant-expression :
I propose that the case expression of the switch statement
be changed from "integral constant-expression" to "integral expression".
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |