Hello,
I have a situation that I wish some help with. I have a DataSet object with DataTables populated from a ms access database. Each DataTable has a RunLogTitle. I have a TreeView object with TreeNodes that correspods to the Names of each DataTable's RunLogTitle. When the user clicks on a TreeNode the corresponding DataTable shows up in the DataGrid.
This is working great, but I would want to use a DataView object to show only the components of each DataTable in the DataGrid. I am using a DataGridTableSt yle object to then create DataGridColumnS tyles.
Here is the problem, in the DataGridTableSt yle I have set the MappingName to a DataView object that I have created in the constructor, here is the code that appears in the constructor of the class:
this.myDataView = new DataView(new DataTable);
this.MyDataView .Table.TableNam e = "MyDataView ";
When the form opens up, the DataGrid is populated with the appropriate DataView and the appropriate DataGridColumnS tyles only showing the data I wish to show up. HOwever when I click on a different TreeNode, I get an error message stating that "MyDataView " already belongs to the DataSet.
I have been going nuts on trying to solve this, how can I set the DataView to show the other DataTale without getting this message? This is the best way that I can describe this problem, if anyone out there can help me with this I'll greatly appreicate it!
thanks,
ed 2 2483
Hi there,
what you need is not to set the table name every time, but simply assign the
new one to the dataGridTableSt yle's mapping name right after setting the new
datasource.
dataGrid1.DataS ource = new DataView(dataTa ble2, ....);
dataGridTableSt yle1.MappingNam e = dataTable2.Tabl eName;
This should work.
Good luck,
Branimir
--
Branimir Giurov
MCSD.NET, MCDBA www.sofiadev.org
"Ed_P." <Ed*@discussion s.microsoft.com > wrote in message
news:7A******** *************** ***********@mic rosoft.com... Hello,
I have a situation that I wish some help with. I have a DataSet object
with DataTables populated from a ms access database. Each DataTable has a
RunLogTitle. I have a TreeView object with TreeNodes that correspods to the
Names of each DataTable's RunLogTitle. When the user clicks on a TreeNode
the corresponding DataTable shows up in the DataGrid. This is working great, but I would want to use a DataView object to show
only the components of each DataTable in the DataGrid. I am using a
DataGridTableSt yle object to then create DataGridColumnS tyles. Here is the problem, in the DataGridTableSt yle I have set the MappingName
to a DataView object that I have created in the constructor, here is the
code that appears in the constructor of the class: this.myDataView = new DataView(new DataTable); this.MyDataView .Table.TableNam e = "MyDataView ";
When the form opens up, the DataGrid is populated with the appropriate
DataView and the appropriate DataGridColumnS tyles only showing the data I
wish to show up. HOwever when I click on a different TreeNode, I get an
error message stating that "MyDataView " already belongs to the DataSet. I have been going nuts on trying to solve this, how can I set the DataView
to show the other DataTale without getting this message? This is the best
way that I can describe this problem, if anyone out there can help me with
this I'll greatly appreicate it! thanks, ed
Thanks Branimir! I'll give this a try!
"Branimir Giurov" wrote: Hi there,
what you need is not to set the table name every time, but simply assign the new one to the dataGridTableSt yle's mapping name right after setting the new datasource.
dataGrid1.DataS ource = new DataView(dataTa ble2, ....); dataGridTableSt yle1.MappingNam e = dataTable2.Tabl eName;
This should work.
Good luck, Branimir
-- Branimir Giurov MCSD.NET, MCDBA www.sofiadev.org "Ed_P." <Ed*@discussion s.microsoft.com > wrote in message news:7A******** *************** ***********@mic rosoft.com... Hello,
I have a situation that I wish some help with. I have a DataSet object with DataTables populated from a ms access database. Each DataTable has a RunLogTitle. I have a TreeView object with TreeNodes that correspods to the Names of each DataTable's RunLogTitle. When the user clicks on a TreeNode the corresponding DataTable shows up in the DataGrid. This is working great, but I would want to use a DataView object to show
only the components of each DataTable in the DataGrid. I am using a DataGridTableSt yle object to then create DataGridColumnS tyles. Here is the problem, in the DataGridTableSt yle I have set the MappingName
to a DataView object that I have created in the constructor, here is the code that appears in the constructor of the class: this.myDataView = new DataView(new DataTable); this.MyDataView .Table.TableNam e = "MyDataView ";
When the form opens up, the DataGrid is populated with the appropriate DataView and the appropriate DataGridColumnS tyles only showing the data I wish to show up. HOwever when I click on a different TreeNode, I get an error message stating that "MyDataView " already belongs to the DataSet. I have been going nuts on trying to solve this, how can I set the DataView
to show the other DataTale without getting this message? This is the best way that I can describe this problem, if anyone out there can help me with this I'll greatly appreicate it! thanks, ed
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Raymond Lewallen |
last post by:
I have a dataview in which the sort property will not sort the dataview.
Here's is a simple scenario similar to what I am doing:
Class Foo
Private Function Retrieve() As DataView
' Returns a DataView with 2 columns and 3 rows
Dim ADOHelper As New DAL.ADOHelper
Return ADOHelper.GetMyDataview()
End
|
by: Martin Schmid |
last post by:
I am trying to implement a DataView for a DataGrid so I can sort at runtime
by clicking on column headers. My initial page load works... it displays
the data However, when I click a column heading at run time, the data
doesn't sort as expected, in fact, the DataGrid becomes empty, all I see are
column headings:
SqlConnection sqlConnection;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected ProjContMan.dsProjByDate...
|
by: Joe |
last post by:
I have a DataView and would like to extract data from it and write it to a
ListView.
Can I only accomplish this with the DataViewRows Object array? Is there a
way forme to enumerate through the rows of the DataView without using the
DataViewRows array?
TIA,
--
Joe
|
by: Jonathan Allen |
last post by:
What could cause a stack trace like this?
Message:Object reference not set to an instance of an object.
Stack Trace:
at System.Data.DataView.GetRecord(Int32 recordIndex)
at System.Data.DataView.get_RowViewCache()
at System.Data.DataView.GetElement(Int32 index)
at System.Data.DataView.get_Item(Int32 recordIndex)
at myCode.myMethod
|
by: Mark |
last post by:
Hi all, quick question , a DataView is
memory resident "view" of data in a data table therefore once populated you
can close the connection to the database. Garbage collection can then be
used to "clean up" the DataView once it is not referenced and will not
effect the number of connections to the database.
A DataReader on the other hand always maintains a connection to the database
and must be explicitly closed (Do not rely on garbage...
| |
by: kjvt |
last post by:
Based on a prior posting, I've written a function to convert a
recordset to a dataview. The first call to the function for a given
recordset works perfectly, but the second call always returns a
dataview with a count = 0. Can someone explain why and how I might
work around this problem?
Here is the code for my function:
Public Shared Function GetViewFromRS(ByVal pRS As ADODB.Recordset) _
As DataView
|
by: Steve |
last post by:
I have a form with a dataset and a datagrid.
I created a dataview on this dataset.
When the user modifies the datagrid, I look up this record in the dataview
to make sure it is unique.
Here is the confusion.........
I thought that the DataView is the view from the dataset, but it seems that
the dataview has the records that are in the datagrid, because everytime I
search for a record that I know is NOT in the dataset, it finds it. I...
|
by: Able |
last post by:
Dear friends
Dim myDataView as DataView = New DataView(dsData.Tables("tblCustomers"))
myDataView.RowFilter = "City = 'London'"
My question is how to loop through all rows in myDataView and edit the field
fldZipCode so fldZipCode = "9800"
Regards Able
|
by: Marc R. |
last post by:
Hi all,
I edit records using a form that have multiple control bind on Dataview, But
I don't want to update right always to database, I would like to delay until
all Changes (add all new record using a form or edit various existing
records)
This way I could minimize transaction on server..
|
by: James |
last post by:
Basically I have a DataGrid that I'm binding to the results of a stored
procedure call. The recordset is fairly small. Initially I'm creating a
DataSet from the results and binding it. There's a DropDownList on my page
that filters the records that are displayed in the grid.
How I'm currently handling this is when I initially bind, I create a
DataView from the table in the dataset. When the DropDownList changes
selection, I get the...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |