473,804 Members | 3,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to return DataSet

Hello:

I'm creating an ASP.Net application. I need to run a method that would
return a DataSet. I'm new to C#, so I have a problem with it.

In VB.Net I just used to write a function like this:

Public Function GetOrders(ByVal sSQL As String) As DataSet

In C# when I try to write something like this:

public DataSet CreateDataset(s tring sSQL)
{
}

I get an error:
"D:\C#_Projects \connect_class\ connect_class\c lConnect.cs(16) : The type or
namespace name 'DataSet' could not be found (are you missing a using
directive or an assembly reference?)"

How would I do this?

Thank you very much in advance,
--
Peter Afonin
Nov 15 '05 #1
2 13467
you need the system.data namespace in your using section at the top of the
file

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Peter Afonin" <pa**@specialty pulltabs.com> wrote in message
news:uS******** ******@TK2MSFTN GP12.phx.gbl...
Hello:

I'm creating an ASP.Net application. I need to run a method that would
return a DataSet. I'm new to C#, so I have a problem with it.

In VB.Net I just used to write a function like this:

Public Function GetOrders(ByVal sSQL As String) As DataSet

In C# when I try to write something like this:

public DataSet CreateDataset(s tring sSQL)
{
}

I get an error:
"D:\C#_Projects \connect_class\ connect_class\c lConnect.cs(16) : The type or
namespace name 'DataSet' could not be found (are you missing a using
directive or an assembly reference?)"

How would I do this?

Thank you very much in advance,
--
Peter Afonin

Nov 15 '05 #2
Thank you, Alvin.

"Alvin Bruney" <vapordan_spam_ me_not@hotmail_ no_spamhotmail. com> wrote in
message news:Or******** ******@TK2MSFTN GP12.phx.gbl...
you need the system.data namespace in your using section at the top of the
file

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Peter Afonin" <pa**@specialty pulltabs.com> wrote in message
news:uS******** ******@TK2MSFTN GP12.phx.gbl...
Hello:

I'm creating an ASP.Net application. I need to run a method that would
return a DataSet. I'm new to C#, so I have a problem with it.

In VB.Net I just used to write a function like this:

Public Function GetOrders(ByVal sSQL As String) As DataSet

In C# when I try to write something like this:

public DataSet CreateDataset(s tring sSQL)
{
}

I get an error:
"D:\C#_Projects \connect_class\ connect_class\c lConnect.cs(16) : The type or namespace name 'DataSet' could not be found (are you missing a using
directive or an assembly reference?)"

How would I do this?

Thank you very much in advance,
--
Peter Afonin


Nov 15 '05 #3

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

Similar topics

1
1833
by: | last post by:
The following function is used in my webservice which returns a dataset. I now need to return the dataset as xml and have no idea how to do it. Can anyone help ? Thanks in Advance Private Function GetDataSetXML(ByVal strSQL As String) As dataset
1
5236
by: Patrik | last post by:
Hi I want to return a dataset from a webservice and exclude the schema. How can I do this? /Patrik
2
13058
by: JS | last post by:
I'm trying to create a data layer and having problems returning a DataSet from my code that's in a class module. Please forgive me. I'm new to C# (VB'er). I decided to create my data layer in small steps. Right now, I'm just trying to attach a ComboBox to a dataset that's in my class module. In the class, I call a Stored Procedure. I know how to set up the connection, command, adapter, and dataset, what I'm having a problem with is,...
13
2495
by: Adie | last post by:
Hi, is this not possible? public DataSet getDimensions() { } public SqlDataReader getDimensions() { }
3
1420
by: Robert May | last post by:
Question, Say I have the following: Using(DataSet ds=new DataSet) { ... da.fill(ds) ... return ds;
7
5770
by: Shaine Fisher | last post by:
I have had a look around but I'm either not finding or not seeing the answer to this, what i want to do is reurn the results as an array, or some other worldly useful format that flash mx2004 can read. But when I did thiss I was told datasets were the way to go, but needs an array, prefer typed as were changing it. Here is the current code: (shortened for readability) public class WebService1{
1
20964
by: R.A. | last post by:
Hi, I have an web service method that accept an xml document and returns a different xml document. Based on the input xml I fill a dataset with information from a database. If the dataset has rows then I need to return those rows to the consumer. I can't tell if the consumer of the web service will use .Net or maybe java. 1) If the web service method returns a Dataset then the consumer will get information on the Dataset. What if the...
1
2183
by: HardBap | last post by:
I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe tool. I want to be able to access fields using ds.Customer.CompanyName. The problem is when I return this DataSet from a Web Service it adds another Table to the DataSet that contains the data. I have to access the data using ds.Tables.Rows.ToString(). This defeats the whole purpose of using a strongly typed DataSet. Thanks in advance for the help.
5
3548
by: MounilK | last post by:
this.btnMybtn.Click += new System.EventHandler(this.btnMyBtn_Click); private DataSet btnMyBtn_Click(object sender, System.EventArgs e) { DataSet dtsReportData = ShowReport(); return dtsReportData; }
11
2900
by: casucci | last post by:
I do a return as XMLDataDocument in my webservice but it returns not with the namespaces etc in them. Anyone have and example where I can have the webservice return it as a XML. C# preferred. Flash just sees it as an object when it calls the web service. Thanks
0
9704
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
10561
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10302
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,...
1
7608
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
5505
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
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
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
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2976
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.