473,804 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help: fill dataset

Tee
Hi,

I need some help about filling dataset, I am not sure how to describe it, so
I give the example here.

da = new OleDbDataAdapte r("SELECT * FROM Path WHERE PathID=1", cnn);

da.Fill(DataSet , "Path");

this is the code of current DataAdapter filling up a DataSet.

What I wanted to do now is fill the DataSet with specified data from Code,
not from DataAdapter.

Is this possible? if yes, how to do it?

Thanks,
Tee
Nov 16 '05 #1
3 3386
U¿ytkownik "Tee" <th*@streamyx.c om> napisa³ w wiadomo¶ci
news:%2******** **********@tk2m sftngp13.phx.gb l...
Hi,

I need some help about filling dataset, I am not sure how to describe it,
so
I give the example here.

da = new OleDbDataAdapte r("SELECT * FROM Path WHERE PathID=1", cnn);

da.Fill(DataSet , "Path");

this is the code of current DataAdapter filling up a DataSet.

What I wanted to do now is fill the DataSet with specified data from Code,
not from DataAdapter.

Is this possible? if yes, how to do it?


For example:

DataRow dr = DataSet["Path"].NewRow();
dr[0] = 34;// value of 34 to first field
dr["AnotherCol umn"] = "A string";
....
etc.

DataSet["Path"].Rows.Add(dr);

I hope it helps.
Grzegorz

Nov 16 '05 #2
Something along these lines should work. Replace field1 with your field
names.

Use the NewRow() method of the Dataset DataTable, populate the data and Add
it to the DataTable Rows colleciton.

System.Data.Dat aSet DataSet1 = new System.Data.Dat aSet();

System.Data.Dat aTable dt = new System.Data.Dat aTable();

System.Data.Dat aColumn dc = new System.Data.Dat aColumn("Field1 ",
typeof(System.S tring));

dt.Columns.Add( dc);

DataSet1.Tables .Add(dt);

System.Data.Dat aRow dr = dt.NewRow();

dr["Field1"] = "your data1";

dt.Rows.Add(dr) ;
"Tee" <th*@streamyx.c om> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
Hi,

I need some help about filling dataset, I am not sure how to describe it,
so
I give the example here.

da = new OleDbDataAdapte r("SELECT * FROM Path WHERE PathID=1", cnn);

da.Fill(DataSet , "Path");

this is the code of current DataAdapter filling up a DataSet.

What I wanted to do now is fill the DataSet with specified data from Code,
not from DataAdapter.

Is this possible? if yes, how to do it?

Thanks,
Tee

Nov 16 '05 #3
Tee,

A dataset is a object that beside relations and other things holds
datatables.
I assume you are talking only about filling the datatable.

In this class description is a very complete sample of that.
http://msdn.microsoft.com/library/de...ClassTopic.asp

Adding a datatable to a dataset is nothing more than

dim ds as new dataset
ds.tables.add(m ydatatable)

I hope this helps?

Cor

"Tee" <th*@streamyx.c om>
Hi,

I need some help about filling dataset, I am not sure how to describe it,
so
I give the example here.

da = new OleDbDataAdapte r("SELECT * FROM Path WHERE PathID=1", cnn);

da.Fill(DataSet , "Path");

this is the code of current DataAdapter filling up a DataSet.

What I wanted to do now is fill the DataSet with specified data from Code,
not from DataAdapter.

Is this possible? if yes, how to do it?

Thanks,
Tee

Nov 16 '05 #4

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

Similar topics

1
350
by: Gary | last post by:
HI, I'm facing a problem while updating a ADO recordset after modifying its records using the Dataset( ADO.Net). I'm calling a method of a COM component from C# code. The method returns a disconnected ADO recordset object which I use to fill the Dataset using the
1
1129
by: Mike | last post by:
I have a web page that displays contact people in a drop down. the users selects a person then clicks the go button. The datagrid should pop with all the information on the select contact person, correct? Well, now my issue. I have 5 contact names in the drop down, (pop from DB) when I select one nothing happens except for one name. I only get information back for only one person, nothing happens if i select a different name. The grid...
3
1308
by: Hamza Al Ali | last post by:
Hi, I am new at ASP.NET, and I need some help from you. I am started with a first example got it from MSDN related to the Studio.NET, I am going through the example step by step. The example is easy and simple which is about how to display data from database (Pubs) on web page using dataset (SQL Server 7). actually i know the username but i do not the password of it, so i created a new login
3
1532
by: Mike | last post by:
I have a web page that displays contact people in a drop down. the users selects a person then clicks the go button. The datagrid should pop with all the information on the select contact person, correct? Well, now my issue. I have 5 contact names in the drop down, (pop from DB) when I select one nothing happens except for one name. I only get information back for only one person, nothing happens if i select a different name. The grid...
1
2642
by: keith.walter | last post by:
My first asp.net app is almost "done" and I am stuck. Here is my situation: I have a "mother" page add_customer.aspx and a"child" user control add_group.ascx. On the mother page is an "add group" button that makes the the panel inwhich the add_customer control resides VISIBLE=True. On the control, the user can edit the list of groups, or add a new one. After the edit is complete I want to make the panel again VISIBLE=False, as well as...
5
2300
by: moondaddy | last post by:
I have a website where cataloge pages are populated by calling a stored procedure on sql server. I use the sql data adapter's fill method to call this stored procedure and fill the dataset. about 6 to 15 times a day the server hangs and times out when this fill method is called. The SP is simple and uses very little resources (as tested using client statistics in query analyzer). Here's data from my error log which includes the...
3
998
by: Tee | last post by:
Hi, I need some help about filling dataset, I am not sure how to describe it, so I give the example here. da = new OleDbDataAdapter("SELECT * FROM Path WHERE PathID=1", cnn); da.Fill(DataSet, "Path");
1
1682
by: scottin | last post by:
I setup the dataset, which is the datasource for a datagrid. When I originally fill the dataset, the data is loaded into dataset.tables(0). (dataset.tables(0).rows.count = 8) Then, if a row gets added to the table, I want to refresh the dataset. When I do so, the data is loaded into dataset.tables(1). (dataset.tables(0).rows.count = 0, dataset.tables(1).rows.count = 8) (We can go into why the record isn't added later)
4
4623
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
0
9594
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
10350
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
10351
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9174
agi2029
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...
1
7638
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
6866
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
5534
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...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3002
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.