Click here to Skip to main content
15,897,182 members
Home / Discussions / C#
   

C#

 
GeneralRe: URL Encoding - prevent "|" encoding as %7C Pin
WillemM17-Oct-04 7:25
WillemM17-Oct-04 7:25 
GeneralRe: URL Encoding - prevent "|" encoding as %7C Pin
Helix018-Oct-04 2:15
Helix018-Oct-04 2:15 
QuestionHow using class from another project Pin
Mikel Fayad16-Oct-04 22:50
Mikel Fayad16-Oct-04 22:50 
AnswerRe: How using class from another project Pin
nxde200016-Oct-04 23:26
nxde200016-Oct-04 23:26 
GeneralRe: How using class from another project Pin
Mikel Fayad17-Oct-04 21:55
Mikel Fayad17-Oct-04 21:55 
GeneralUse Graph.Chart in MSWord Pin
nxdess16-Oct-04 21:45
sussnxdess16-Oct-04 21:45 
GeneralDataTable already belongs to another DataSet Pin
myNameIsRon16-Oct-04 20:40
myNameIsRon16-Oct-04 20:40 
GeneralRe: DataTable already belongs to another DataSet Pin
Heath Stewart16-Oct-04 20:49
protectorHeath Stewart16-Oct-04 20:49 
Add the DataTable to the DataSet only once (perhaps in the code that shows the report) but then pass a reference to the DataSet as parameters to methods or as properties.

Most objects in .NET are references, so passing around the variables is actually passing around a reference to the original object. Only a handful of types - your primitives (numbers and bool), structures, and enumerations - are value types and passed by value, so any changes to them won't change the original.

The problem you're experience is exactly what the error tells you - the DataTable already belongs to another DataSet and cannot be added to another one. Because your code is being executed twice, the table is added (or, rather, you're trying to add) to two different instances of a DataSet.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: DataTable already belongs to another DataSet Pin
myNameIsRon17-Oct-04 15:29
myNameIsRon17-Oct-04 15:29 
GeneralCount Char in String Pin
Bedevian16-Oct-04 19:08
Bedevian16-Oct-04 19:08 
GeneralRe: Count Char in String Pin
Alex Korchemniy16-Oct-04 20:58
Alex Korchemniy16-Oct-04 20:58 
GeneralPlease help User Control Pin
robmays16-Oct-04 16:45
robmays16-Oct-04 16:45 
GeneralRe: Please help User Control Pin
afinnell17-Oct-04 8:57
afinnell17-Oct-04 8:57 
GeneralRe: Please help User Control Pin
robmays17-Oct-04 20:47
robmays17-Oct-04 20:47 
GeneralMultiline text not displayed correctly in text box Pin
Luis Alonso Ramos16-Oct-04 12:38
Luis Alonso Ramos16-Oct-04 12:38 
GeneralRe: Multiline text not displayed correctly in text box Pin
Heath Stewart16-Oct-04 21:09
protectorHeath Stewart16-Oct-04 21:09 
GeneralRe: Multiline text not displayed correctly in text box Pin
Luis Alonso Ramos16-Oct-04 21:23
Luis Alonso Ramos16-Oct-04 21:23 
GeneralRe: Multiline text not displayed correctly in text box Pin
Heath Stewart16-Oct-04 21:31
protectorHeath Stewart16-Oct-04 21:31 
GeneralRe: Multiline text not displayed correctly in text box Pin
Luis Alonso Ramos16-Oct-04 21:58
Luis Alonso Ramos16-Oct-04 21:58 
GeneralRe: Multiline text not displayed correctly in text box Pin
Heath Stewart16-Oct-04 22:13
protectorHeath Stewart16-Oct-04 22:13 
GeneralNo validation events when clicking on a toolbar Pin
Luis Alonso Ramos16-Oct-04 12:33
Luis Alonso Ramos16-Oct-04 12:33 
GeneralRe: No validation events when clicking on a toolbar Pin
Alex Korchemniy16-Oct-04 15:01
Alex Korchemniy16-Oct-04 15:01 
GeneralRe: No validation events when clicking on a toolbar Pin
Luis Alonso Ramos16-Oct-04 15:49
Luis Alonso Ramos16-Oct-04 15:49 
GeneralRe: No validation events when clicking on a toolbar Pin
Heath Stewart16-Oct-04 20:58
protectorHeath Stewart16-Oct-04 20:58 
GeneralRe: No validation events when clicking on a toolbar Pin
Luis Alonso Ramos16-Oct-04 22:07
Luis Alonso Ramos16-Oct-04 22:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.