473,398 Members | 2,403 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,398 software developers and data experts.

Data Sets

I tried opening 2 readers with the same connection and
soon found out that can't be done. I found out I need to
use a data set because that is a disconnected set. Can
someone tell me how to create a data set? And also
(mainly) to search through the data set for a particular
record as you do with a reader.

All the info I can find in the groups shows how to fill a
data adapter which I believe is close to what I need.

Thanks
Nov 18 '05 #1
4 1228
DataSet myDS = new DataSet();

thats how you create it...
you can use filter on a datatable within a dataset
DataTable myDT = myDS.Tables[0];

to filter data
http://authors.aspalliance.com/olson...rSortData.aspx

or you can manually iterate the DataTable
foreach myDataRow in myDt.Rows
if(myData.Columns["column"].value == "xyz") (think its value... )
{
do this;
}
------------------------------------------------------- from one of my data
layer objects
SecureHandling mySH = new SecureHandling();

SqlConnection myCon = new
SqlConnection(mySH.Decode(ConfigurationSettings.Ap pSettings["online"]));

try

{

SqlDataAdapter myCommand ;

if(ShowOnlyActiveSizes == false)

myCommand = new SqlDataAdapter("sp_CDB_AvailableSizes_SelectAll", myCon);

else

myCommand = new SqlDataAdapter("sp_CDB_AvailableSizes_SelectActive ", myCon);

myCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet mySizes = new DataSet();

myCon.Open();

myCommand.Fill(mySizes, "mySizes");

return mySizes;

}

finally

{

myCon.Close();

myCon.Dispose();

}
--
Regards,

HD

Once a Geek.... Always a Geek
"brian" <bs******@lbrspec.com> wrote in message
news:0b****************************@phx.gbl...
I tried opening 2 readers with the same connection and
soon found out that can't be done. I found out I need to
use a data set because that is a disconnected set. Can
someone tell me how to create a data set? And also
(mainly) to search through the data set for a particular
record as you do with a reader.

All the info I can find in the groups shows how to fill a
data adapter which I believe is close to what I need.

Thanks

Nov 18 '05 #2
Thanks for your quick reply- How am I telling what the DataSet is to be
filled with? I would like to fill it with a SELECT statement for SQL.
DataSet myDS = new DataSet();

thats how you create it...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
SqlConnection(ConfigurationSettings.AppSettings["online"]);

try

{

SqlDataAdapter myCommand ;

myCommand = new SqlDataAdapter("SELECT * FROM Authors", myCon);

myCommand.SelectCommand.CommandType = CommandType.Text;

DataSet myAuthorDS = new DataSet();

myCon.Open();

myCommand.Fill(myAuthorDS, "myAuthors"); // here you are specifying the
name of the table and the dataset to fill

myCommand.Dispose();

// you can now query the table within.. its name that you specified above is
myAuthors and you asked the command object to fill myAuthorsDS dataset)

return myAuthorDS;

}

finally

{

myCon.Close();

myCon.Dispose();

}
--
Regards,

HD

Once a Geek.... Always a Geek
"brian shannon" <bs******@lbrspec.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Thanks for your quick reply- How am I telling what the DataSet is to be
filled with? I would like to fill it with a SELECT statement for SQL.
DataSet myDS = new DataSet();

thats how you create it...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4
SqlConnection(ConfigurationSettings.AppSettings["online"]);

try

{

SqlDataAdapter myCommand ;

myCommand = new SqlDataAdapter("SELECT * FROM Authors", myCon);

myCommand.SelectCommand.CommandType = CommandType.Text;

DataSet myAuthorDS = new DataSet();

myCon.Open();

myCommand.Fill(myAuthorDS, "myAuthors"); // here you are specifying the
name of the table and the dataset to fill

myCommand.Dispose();

// you can now query the table within.. its name that you specified above is
myAuthors and you asked the command object to fill myAuthorsDS dataset)

return myAuthorDS;

}

finally

{

myCon.Close();

myCon.Dispose();

}
--
Regards,

HD

Once a Geek.... Always a Geek
"brian shannon" <bs******@lbrspec.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Thanks for your quick reply- How am I telling what the DataSet is to be
filled with? I would like to fill it with a SELECT statement for SQL.
DataSet myDS = new DataSet();

thats how you create it...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #5

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

Similar topics

2
by: ben moretti | last post by:
hi i'm learning python, and one area i'd use it for is data management in scientific computing. in the case i've tried i want to reformat a data file from a normalised list to a matrix with some...
6
by: Saikrishna | last post by:
Hi friends, I am trying to choose the best possible data structure for the probelm I am going to describe now. I have lets say tens of thousands of numbers in file1 and tens of thousands of...
9
by: Eric Lilja | last post by:
Hello, consider the following two functions: /* function foo() */ void foo() { float y = 0.0f; float sum = 0.0f; for(int i = 0; i < num; ++i) {
4
by: Oyvind | last post by:
I'm working on a Windows forms/C# database application. My background is 6-7 years of VB 4 - 6, MS Access, VC++, mixed in with a lot of T-SQL and MS SQL Server in general and some OOA/OOD. ...
2
by: Matthias S. | last post by:
Hi, I have to write an application which extensively uses an SQL Database. For a simple example say I have the following tables with the appropriate fields. 1. Company (ID, Name,...
2
by: jason | last post by:
the enterprise is going to eventually convert the existing ASP Classic website to ASP.NET until that time, development has already begun for a C# library of business objects. for the most part,...
6
by: Ben Finney | last post by:
Howdy all, Summary: I'm looking for idioms in unit tests for factoring out repetitive iteration over test data. I explain my current practice, and why it's unsatisfactory. When following...
2
by: alex.mcshane | last post by:
Hi - I would be grateful for any knowledge regarding the following. Whilst QAing Stored Procedures developed by colleagues, I noticed the following 'superflous' parameter specifications:- 1)...
11
by: mwt | last post by:
Hi. I'm reworking a little app I wrote, in order to separate the data from the UI. As a start, I wanted to create a iron-clad data recepticle that will hold all the important values, and stand up...
3
by: ArmageddonAsh | last post by:
I'm trying to make an application that will allow the user to enter data into a flexgrid (that's done) and then save the data from that flexgrid into a CSV file but even though the file is made none...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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
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,...
0
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...

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.