473,396 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Loading data from a Dataset that is created at Runtime

Hi,
I understand in order to extract data from the tables in a Dataset and
setting it to control, the following csharp syntax applies.

textBox1.Text = northwindDataSet.Customers[3].ContactName;

However I am creating a Dataset at runtime when query results from a
WebService are returned as a Dataset. I know that it will contain only one
table (Table1) and contain and number of fields (Field1, Field2, Field3).
And Visual Studio will not allow me to compile the below code as these
references do not exist at Runtime.

textBox1.Text = myDataSet.Table1[0].Field1;

How else may I reference Dataset tablenames/fieldnames that do not exist at
compile time?

Any help would be greatly appreciated.
Jul 18 '06 #1
4 3929
Hi,

"Khurram" <kn*****@gmail.comwrote in message
news:E8**********************************@microsof t.com...
Hi,
I understand in order to extract data from the tables in a Dataset and
setting it to control, the following csharp syntax applies.

textBox1.Text = northwindDataSet.Customers[3].ContactName;
So you have a strong typed dataset.

However I am creating a Dataset at runtime when query results from a
WebService are returned as a Dataset.
It's returned as a strong typed dataset ???
I know that it will contain only one
table (Table1) and contain and number of fields (Field1, Field2, Field3).
And Visual Studio will not allow me to compile the below code as these
references do not exist at Runtime.

textBox1.Text = myDataSet.Table1[0].Field1;
It should be dataset.Tables[0].Rows[0]["Field1"];

Again, it does depend if the dataset is strong typed or not

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jul 18 '06 #2
Hi

I just saw your other post and effectively you are not using a strong typed
dataset, just use the code I posted.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Khurram" <kn*****@gmail.comwrote in message
news:E8**********************************@microsof t.com...
Hi,
I understand in order to extract data from the tables in a Dataset and
setting it to control, the following csharp syntax applies.

textBox1.Text = northwindDataSet.Customers[3].ContactName;

However I am creating a Dataset at runtime when query results from a
WebService are returned as a Dataset. I know that it will contain only
one
table (Table1) and contain and number of fields (Field1, Field2, Field3).
And Visual Studio will not allow me to compile the below code as these
references do not exist at Runtime.

textBox1.Text = myDataSet.Table1[0].Field1;

How else may I reference Dataset tablenames/fieldnames that do not exist
at
compile time?

Any help would be greatly appreciated.

Jul 18 '06 #3
Hi,
So you have a strong typed dataset.
Firstly as you know I have not got a strongly typed dataset but I think I
should. How would I do that and should i do it at the client or web service
side? I think it would be good if it is returned as a strongly typed
dataset.

You wrote:
It should be dataset.Tables[0].Rows[0]["Field1"];
Since my aim for this dataset is to populate the fields of my client website
with the contents of the dataset, I wrote the following code. There is data
in the Dataset

testDatasetTextBox.Text = assessmentDataSet.Tables[0].Rows[0]["aap_key"];

This gives me an error underlining the Dataset (assessmentDataSet):

Cannot implicitly convert type 'object' to 'string'. An explicit conversion
exists (are you missing a cast?)

How else do I extract data and assign it to a control?

Thank you again

Khurram
Jul 18 '06 #4
Hi,

Sorry I was not thinking straight. Just need to convert the field being
picked up to string using ToString(). For example

testDatasetTextBox.Text =
assessmentDataSet.Tables[0].Rows[0]["aap_key"].ToString();
Works fine Thanx.

Khurram

"Khurram" wrote:
Hi,
So you have a strong typed dataset.

Firstly as you know I have not got a strongly typed dataset but I think I
should. How would I do that and should i do it at the client or web service
side? I think it would be good if it is returned as a strongly typed
dataset.

You wrote:
It should be dataset.Tables[0].Rows[0]["Field1"];

Since my aim for this dataset is to populate the fields of my client website
with the contents of the dataset, I wrote the following code. There is data
in the Dataset

testDatasetTextBox.Text = assessmentDataSet.Tables[0].Rows[0]["aap_key"];

This gives me an error underlining the Dataset (assessmentDataSet):

Cannot implicitly convert type 'object' to 'string'. An explicit conversion
exists (are you missing a cast?)

How else do I extract data and assign it to a control?

Thank you again

Khurram
Jul 18 '06 #5

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

Similar topics

16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
3
by: Thad | last post by:
I'm new to C# and I was trying to create a Crystal Report. I've designed a simple report and I've used several methods for attaching fields to the report at design time. I've used a DataSet that...
12
by: VMI | last post by:
For some reason, the process of retrieving data (about 20 records) from an Access table that has 400K records to a dataTable is taking over 3 mins. to complete. Below is my code to connect to the...
6
by: Jon Davis | last post by:
I like the drag-and-drop accessibility of dragging a table to a Web Forms designer and seeing a SqlDataAdapter automatically created for me.. being able to create a DataSet from that is fun and...
4
by: Fred Nelson | last post by:
I have an applicatioin that I'm writing that uses a "case" file that contains over 350 columns and more may be added in the future. I would like to create a dataset with all the column names and...
3
by: Tyranno.Lex | last post by:
I am using Visual Studio .NET 2003 and have successfully deployed a commercial web application written in C# and ASP.NET. I am now wanting to add reporting using Crystal Reports and am having a...
7
by: GaryDean | last post by:
I'm trying to load a GridView up with data manually, in code. I'm not using any datasource. Using this code.... ArrayList myRowArrayList; GridViewRow myGVR = new...
3
by: natrajsr | last post by:
Hi, I want to load the data of a excel sheet or in the exact excel sheet format into a Rich TextBox control. I have already worked with loading WORD into a Rich TextBox. It is working fine.;...
0
by: Chris | last post by:
Hello, I have a problem with re-loading datasets. As a simple example, if I have an SQL table of addresses comprising active and inactive addresss, I wish to load either sub-set by clicking on...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
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,...
0
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...
0
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...
0
tracyyun
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...
0
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,...

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.