473,585 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

filling an array from a dataset

Hello,

How can I declare an array, and set it to equal all the items in a column of
a dataset?

TIA,

Amber
Sep 24 '05 #1
4 1497
Amber,

A dataset has no column, what do you mean?

Cor
Sep 24 '05 #2
CT
I assume you want to copy the rows from a table in the DataSet, right? If
so, you need to manually loop through the rows and copy across to the array.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Communities - http://community.integratedsolutions.dk

"amber" <am***@discussi ons.microsoft.c om> wrote in message
news:39******** *************** ***********@mic rosoft.com...
Hello,

How can I declare an array, and set it to equal all the items in a column
of
a dataset?

TIA,

Amber

Sep 24 '05 #3
can you explain how to do that?

"CT" wrote:
I assume you want to copy the rows from a table in the DataSet, right? If
so, you need to manually loop through the rows and copy across to the array.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Communities - http://community.integratedsolutions.dk

"amber" <am***@discussi ons.microsoft.c om> wrote in message
news:39******** *************** ***********@mic rosoft.com...
Hello,

How can I declare an array, and set it to equal all the items in a column
of
a dataset?

TIA,

Amber


Oct 24 '05 #4
CT
Here's one way:

' Populate dataset
SqlDataAdapter1 .Fill(dataset1, "Categories ")

' Create and dimension row array
Dim rows(dataset1.T ables("Categori es").Rows.Count ) As DataRow
' Loop through all rows in Categories table
For i As Integer = 0 To dataset1.Tables ("Categories"). Rows.Count - 1
rows(i) = dataset1.Tables ("Categories"). Rows(i)
Next

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk

"Cath" <Ca**@discussio ns.microsoft.co m> wrote in message
news:6C******** *************** ***********@mic rosoft.com...
can you explain how to do that?

"CT" wrote:
I assume you want to copy the rows from a table in the DataSet, right? If
so, you need to manually loop through the rows and copy across to the
array.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Communities - http://community.integratedsolutions.dk

"amber" <am***@discussi ons.microsoft.c om> wrote in message
news:39******** *************** ***********@mic rosoft.com...
> Hello,
>
> How can I declare an array, and set it to equal all the items in a
> column
> of
> a dataset?
>
> TIA,
>
> Amber


Oct 24 '05 #5

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

Similar topics

1
2091
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the content of an untyped DataSet. This is to be done in the "DropDown" Event (since the dataset is empty at program start). If I go with this:
5
7020
by: Cybertof | last post by:
Hello, Is it necessary to initially fill a dataset to be able to add a new row to the dataset and then update the undercover database ? (In the case of a very large database, this would mean that all the database content should be loaded before beeing able to add a new row, and i don't want to load anything...) Is it possible in the...
1
2202
by: Krzysztof Karnicki | last post by:
I have such a problem… I have create my custom DataGridColumn inheriting from System.Windows.Forms.DataGridColumnStyle on using it on DataGrid, to show rows painted by me self. Because dates taken from database are very large, and filling DataSet bounded to this DataGrid takes some time, a decided to put fill logic into new thread. And so...
3
1994
by: crjunk | last post by:
I have a 3 table in my DataSet that I'm filling with data. After I've filled these 3 tables, I'm then trying to run a query that will fill a 4th table in the DataSet with data from the three tables that are already pouplated. When my code tries to fill the 4th table, ReportData, I receive the following error message: Invalid object name...
4
305
by: amber | last post by:
Hello, How can I declare an array, and set it to equal all the items in a column of a dataset? TIA, Amber
4
10572
by: gillcleeren | last post by:
I have a datagrid that has to be filled in a WinForms application. The data comes from an Oracle database. The normal procedure would be filling a dataset, but I have the problem that there are over 100.000 records in the tables, so this has very low performance when executing. I then tried using an OracleDataReader, but for some reason,...
0
1421
by: Derek Vincent | last post by:
Why am I having problems filling my dataset when I select fields of type varchar(350) from interbase? I can fill the dataset when I select every other field in the table but I receive and error message that says "object reference not set to an instance of an object" when I return the varchar field." The detailed error message is below. ...
1
1588
by: WayneM | last post by:
I have compact framework app that I was trying to test out on a windows form, but I cannot get past the very first step of simply filling a DataGrid from a DataSet. My code is Dim sqlStmt As String = "Select VendorName, StartWeek from InventorySchedule Where FinishDate is Null and StartWeek<'" & Now & "'" Dim cmdDB As New...
11
2512
by: Sid Price | last post by:
I have Dataset that I need to filter into another Dataset for display and I can not find out how to do this. I have found methods for copying a Dataset but I can not see how to filter the rows copied using my query. I hoped to be able to use a DataAdaptor to do this but SelectCommand requires a connection and I don't see how to create a...
0
7908
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...
0
8199
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, 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. ...
0
8336
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...
1
7950
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...
0
8212
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5389
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...
0
3835
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...
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1175
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...

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.