473,803 Members | 3,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting a Dataview into a Dataset

Hi can any one help me in converting a DataView into a DataSet or a DataTable
into a DataSet,
I tried the following ways

dSet= ((DataSet)_grid RegStudDetails. DataSource);
dSet = ((DataSet)_grid RegStudDetails. DataSource).Tab les[0].DataSet;
studData = ((DataSet)dView ).Tables[0].DataSet;

But not working
can you pls help me out
Thanks in advance,
N.Ramakrishnan

Nov 21 '05 #1
6 23323
Let's say your dataview's name is myDataView.

myDataView.Tabl e will return to you the underlying DataTable.
"Ramakrishn an Nagarajan" <ra**********@d iscussions.micr osoft.com> wrote in
message news:87******** *************** ***********@mic rosoft.com...
Hi can any one help me in converting a DataView into a DataSet or a
DataTable
into a DataSet,
I tried the following ways

dSet= ((DataSet)_grid RegStudDetails. DataSource);
dSet = ((DataSet)_grid RegStudDetails. DataSource).Tab les[0].DataSet;
studData = ((DataSet)dView ).Tables[0].DataSet;

But not working
can you pls help me out
Thanks in advance,
N.Ramakrishnan

Nov 21 '05 #2
Ramakrishnan.

A dataview holds no data.

However it holds (in Net 1.x) a reference to its datatable and in 2.0 it
will holds a reference to get its selected/sorted datarowviews.

Therefore what you want you can do in version 2.0. For 1.x you can use this
sample (what is not so much more work).

http://www.windowsformsdatagridhelp....7-d6ad9bebf57f

I hope this helps,

Cor

Nov 21 '05 #3
Ramakrishnan Nagarajan wrote:
Hi can any one help me in converting a DataView into a DataSet or a DataTable
into a DataSet,
I tried the following ways

dSet= ((DataSet)_grid RegStudDetails. DataSource);
dSet = ((DataSet)_grid RegStudDetails. DataSource).Tab les[0].DataSet;
studData = ((DataSet)dView ).Tables[0].DataSet;

But not working
can you pls help me out
Thanks in advance,
N.Ramakrishnan


You don't convert a datatable to a dataset. You add a table to a dataset.

From the help file under: DataSet Class, adding DataTable

Dim custDS As DataSet = New DataSet("Custom erOrders")

Dim ordersTable As DataTable = custDS.Tables.A dd("Orders")

Dim pkCol As DataColumn = ordersTable.Col umns.Add("Order ID",
Type.GetType("S ystem.Int32"))
ordersTable.Col umns.Add("Order Quantity", Type.GetType("S ystem.Int32"))
ordersTable.Col umns.Add("Compa nyName", Type.GetType("S ystem.String"))

ordersTable.Pri maryKey = New DataColumn() {pkCol}
Chris
Nov 21 '05 #4
Hi,
Thanks to every one who have dropped their help for my post.
I have no problem at all in sorting the data in the grid.
At first the DataSet will contain the data from the DataBase. Am fetching
all the data from the DataSet and create a new DataTable along with the new
values entered by the user in the DataGrid. Then Inorder to sort the data am
casting it to a DataView and sorted. Then I am binding the DataView to the
Grid. At this point I want all the data in the DataView to be in the DataSet
for future reference by the same event. So to have all those data in the
DataView to be in the DataSet what can I do. Can you please help me out.
Thanks,
N.Ramakrishnan

"Cor Ligthert [MVP]" wrote:
Ramakrishnan.

A dataview holds no data.

However it holds (in Net 1.x) a reference to its datatable and in 2.0 it
will holds a reference to get its selected/sorted datarowviews.

Therefore what you want you can do in version 2.0. For 1.x you can use this
sample (what is not so much more work).

http://www.windowsformsdatagridhelp....7-d6ad9bebf57f

I hope this helps,

Cor


Nov 21 '05 #5
RamaKrishnan,

Did you see the sample the only thing you need at the end of that is somehow

ds.Add.Tables(d t)
or instead of that
dt = dtnew.copy
ds.Add.Tables(d tnew)

I hope this helps,

Cor
Nov 21 '05 #6
Thanks Cor,
You are right and I did that using ds.Tables.Add(d t);
And now dataset is having the values of the datatable.
Thanks a lot again Cor.

N.Ramakrishnan

"Cor Ligthert [MVP]" wrote:
RamaKrishnan,

Did you see the sample the only thing you need at the end of that is somehow

ds.Add.Tables(d t)
or instead of that
dt = dtnew.copy
ds.Add.Tables(d tnew)

I hope this helps,

Cor

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4621
by: Arthur Dzhelali | last post by:
I according to MSDN dataview and dataset are thread safe for read operations, but we run into this scenario. I just would like to see some comments on it. Aplication written in VB.NET it is an ASP.NET app. located on busy web server. Initially we defined dataview slightly wrong and run into the problem. we have dataset cached which has large ammount of data.
3
2529
by: Lerp | last post by:
Hi all, What's the syntax for creating a row out of the current item in a datagrid? Something like this ? Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)
36
4485
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
13
2120
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...
5
8835
by: David Wender | last post by:
I want to create a dataview with a sort on multiple columns. However, when I use FindRows, I only want to search some of the columns, not all. Is this possible? I have not been able to make it happen. Dim objKeys(2) as Object objKeys(0) = "CL" objKeys(2) = 4000 Dim posView As DataView = New DataView(posDS.Tables("Positions"), _
17
2773
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1 first, and the mydataset1 data source was getting from DataGrid.DataSource.
7
8721
by: Brett Romero | last post by:
I have a dataset with one table, which has four columns. All are of type INT. I need to convert this dataset into a dataview so I can sort on the last three columns. I may sort one of the three or all three at once. This dataview will display its results in a winform datagrid. Right now, I create the dataset from a datareader: while(dr.Read()) { drow = _filteredCriteriaDataSet.Tables.NewRow();
4
1584
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...
1
2354
by: jrod11 | last post by:
Hi everyone, I am currently working on a project that pulls data from sql and displays it in an html file. This is working fine, but I am trying to make it a little more fancy using this cool source code found here: http://mattberseth.com/blog/2007/12/creating_a_google_suggest_styl.html In the source code, it is pulling dummy data from an .xml file that stores all of the data. I would like to change the source of the data to a table in my...
0
9700
marktang
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...
0
9564
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,...
0
10310
jinu1996
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...
1
7603
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
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();...
0
5498
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...
1
4275
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
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.