473,506 Members | 9,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datasets - Urgent!!

I have the follow code:

private void crear() {

//creating a dataset

DataSet myDataset=null;
SqlConnection sqlConnection=null;
SqlDataAdapter sqlCommand=null;
try {
//create an instance for a SqlConnection and a Sql Command

sqlConnection = new SqlConnection("server=.; database=JF;
Trusted_Connection=false; uid=sa; pwd=; Pooling=true;");
sqlCommand = new SqlDataAdapter("select
cantidad,concepto,prec_unit,valor_venta from fact_detalle",sqlConnection);
myDataset = new DataSet();

//mark the command as a text
sqlCommand.SelectCommand.CommandType = CommandType.Text;

//open the connection and execute
sqlConnection.Open();
sqlCommand.Fill(myDataset);

}
catch {
throw;
}
finally {
if(sqlConnection!=null)
sqlConnection.Close();
// MessageBox.Show("The connection is close");
}
// return myDataset;

dataGrid1.DataSource=myDataset.Tables[0];
}
private void nueva_fila()

{
DataRow anyRow = myDataset.Tables[0].NewRow();
}
---------------------------------
on nueva_fila there´s an error , when compila the "myDataset" is underlined
and the follow task is shown:

The type or namespace name 'myDataset' could not be found (are you missing a
using directive or an assembly reference?)
---
Why?, it´s because the first void is private.... please help me
Dec 17 '05 #1
1 978
The variable myDataset declared in the private function crear will only
exist in that function. If other function such as nueva_fila() want to
access it, it has to be a member variable, i.e. declared in the class.

Hope this help.

Best regards,
Frankie Leung.

Dec 19 '05 #2

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

Similar topics

4
1725
by: Alpha | last post by:
I have a small Window application and through out the different forms I create a different dataset. At the begining I used the Tools to drag and drop the SqlDataAdapter, connection and dataset...
1
1229
by: Alex | last post by:
I have the follow code: private void crear() { //creating a dataset DataSet myDataset=null; SqlConnection sqlConnection=null; SqlDataAdapter sqlCommand=null; try {
9
2880
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
7
2857
by: Ryan | last post by:
Quite awile ago I posted to this newsgroup in regards to using Datasets in my VB 2005 application. About how many Datasets should be used.. a limit to the number of tables that should be included...
12
4115
by: Simon | last post by:
Hi all, I'm having a baffling problem with a windows service that I'm working on. Basically, I am using a typed dataset to insert a large number of rows into an SQL Server 2005 database. But...
4
1186
by: mohitkatariya | last post by:
i m making relation between 2 datasets but i m geting an error msg that some rows may not be in parent table how can i solve this prblm. its urgent
2
2362
by: itsvineeth209 | last post by:
My task is to create login control without using login control in tools. I shouldnt use sqldatasource or any other. I should use only data sets, data adapters and data readers etc. U had created...
12
3550
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
6
5338
by: Bobby Edward | last post by:
Using ASP.NET 3.5 and MySQL (thru DevArt MyDirect.NET)... On the production server I get a "Parser Error" for every XSD dataset. It works perfect on my dev machine. But, on the production...
0
7220
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
7308
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
7371
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
7479
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
4702
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...
0
3188
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...
0
1534
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 ...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
410
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...

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.