the following codes are error occurs.
basically, I set a breakpoint at BuildingTN, I trace it, and it come up my
intended table, but when I run the program, in my component cobInside, it
always displays somethings from my other table.
DataSet ds = officeAux.DSource;
officeAux.DA.Fill(ds,BuildingTN);
for(int i=0;i<ds.Tables[BuildingTN].Rows.Count;i++)
{
this.cobInside.Items.Add(ds.Tables[BuildingTN].Rows[i].ItemArray[1]);
}
does anyone know what happen??
pei 7 1289
The DataAdapter object's Fill method is overloaded.
You can supply a DataTable rather than a DataSet.
Or, you can supply a DataSet and a string for the
name of the DataTable you want to populate or create, as shown here:
intRowsRetrieved = da.Fill(ds, "Customers");
intRowsRetrieved = da.Fill(ds.Tables("Customers"));
intRowsRetrieved = da.Fill(ds, 11, 10, "Customers");
Looks to me like you are calling the DataSet "BuildingTN" in your code.
Try using soemthing like this to test it out:
this.cobInside.Items.Add(ds.Tables[0].Rows[i].ItemArray
-- where [0] is the ordinal of the table in the multi-table DataSet
--Peter
"pei_world" <pe*******@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP09.phx.gbl... the following codes are error occurs. basically, I set a breakpoint at BuildingTN, I trace it, and it come up my intended table, but when I run the program, in my component cobInside, it always displays somethings from my other table.
DataSet ds = officeAux.DSource; officeAux.DA.Fill(ds,BuildingTN);
for(int i=0;i<ds.Tables[BuildingTN].Rows.Count;i++) { this.cobInside.Items.Add(ds.Tables[BuildingTN].Rows[i].ItemArray[1]); }
does anyone know what happen??
pei
it seen like no working
"pei_world" <pe*******@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP09.phx.gbl... the following codes are error occurs. basically, I set a breakpoint at BuildingTN, I trace it, and it come up my intended table, but when I run the program, in my component cobInside, it always displays somethings from my other table.
DataSet ds = officeAux.DSource; officeAux.DA.Fill(ds,BuildingTN);
for(int i=0;i<ds.Tables[BuildingTN].Rows.Count;i++) { this.cobInside.Items.Add(ds.Tables[BuildingTN].Rows[i].ItemArray[1]); }
does anyone know what happen??
pei
DataSet ds = officeAux.DSource;
officeAux.DA.Fill(ds,BuildingTN);
for(int i=0;i<ds.Tables[BuildingTN].Rows.Count;i++)
{
this.cobInside.Items.Add(ds.Tables[BuildingTN].Rows[i].ItemArray[1]);
}
MessageBox.Show(ds.Tables.Count.ToString()+" "+ds.Tables[1].ToString()+"
"+ds.Tables[BuildingTN].TableName);
from the last MessageBox dialog, it shows the name of table I am accessing
is correct. but just don't know why it use the wrong table,so that it means
dataset contains 2 tables, but it can't access the 2nd table.
"pei_world" <pe*******@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP09.phx.gbl... the following codes are error occurs. basically, I set a breakpoint at BuildingTN, I trace it, and it come up my intended table, but when I run the program, in my component cobInside, it always displays somethings from my other table.
DataSet ds = officeAux.DSource; officeAux.DA.Fill(ds,BuildingTN);
for(int i=0;i<ds.Tables[BuildingTN].Rows.Count;i++) { this.cobInside.Items.Add(ds.Tables[BuildingTN].Rows[i].ItemArray[1]); }
does anyone know what happen??
pei
Ok,
for(int i=0;i<ds.tables[buildingTN].rows.count;i++)
unless buildingTN resolved to an integer value,
shouldn't this be:
for(int i=0;i<ds.tables["buildingTN"].rows.count;i++)
-- in other words, unless buildingTN is a variable of type
int, you would need to place inside quotation marks
to reference an "named" table overload. Check your documentation
your only problem at this point appears to be a minor syntax
error.
--Peter
"pei_world" <pe*******@hotmail.com> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl...
DataSet ds = officeAux.DSource; officeAux.DA.Fill(ds,BuildingTN);
for(int i=0;i<ds.Tables[BuildingTN].Rows.Count;i++) { this.cobInside.Items.Add(ds.Tables[BuildingTN].Rows[i].ItemArray[1]); }
MessageBox.Show(ds.Tables.Count.ToString()+" "+ds.Tables[1].ToString()+" "+ds.Tables[BuildingTN].TableName);
from the last MessageBox dialog, it shows the name of table I am accessing is correct. but just don't know why it use the wrong table,so that it
means dataset contains 2 tables, but it can't access the 2nd table. "pei_world" <pe*******@hotmail.com> wrote in message news:eJ**************@TK2MSFTNGP09.phx.gbl... the following codes are error occurs. basically, I set a breakpoint at BuildingTN, I trace it, and it come up
my intended table, but when I run the program, in my component cobInside,
it always displays somethings from my other table.
DataSet ds = officeAux.DSource; officeAux.DA.Fill(ds,BuildingTN);
for(int i=0;i<ds.Tables[BuildingTN].Rows.Count;i++) {
this.cobInside.Items.Add(ds.Tables[BuildingTN].Rows[i].ItemArray[1]); }
does anyone know what happen??
pei
NO, no, no....
even I change the parameter to ds.Tables[1].TableName, it will get me the
index 0 table, I don't know why.
My BuildingTN is the name of my table, it will resolve to my table name. but
even I replace by "tablename", it still give me the other table's data.
don't know why.
"Peter Bromberg [C# MVP]" <pb*******@yahoo.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl... Ok,
for(int i=0;i<ds.tables[buildingTN].rows.count;i++) unless buildingTN resolved to an integer value, shouldn't this be: for(int i=0;i<ds.tables["buildingTN"].rows.count;i++) -- in other words, unless buildingTN is a variable of type int, you would need to place inside quotation marks to reference an "named" table overload. Check your documentation your only problem at this point appears to be a minor syntax error. --Peter
"pei_world" <pe*******@hotmail.com> wrote in message news:OL**************@TK2MSFTNGP09.phx.gbl...
DataSet ds = officeAux.DSource; officeAux.DA.Fill(ds,BuildingTN);
for(int i=0;i<ds.Tables[BuildingTN].Rows.Count;i++) {
this.cobInside.Items.Add(ds.Tables[BuildingTN].Rows[i].ItemArray[1]); }
MessageBox.Show(ds.Tables.Count.ToString()+"
"+ds.Tables[1].ToString()+" "+ds.Tables[BuildingTN].TableName);
from the last MessageBox dialog, it shows the name of table I am
accessing is correct. but just don't know why it use the wrong table,so that it means dataset contains 2 tables, but it can't access the 2nd table. "pei_world" <pe*******@hotmail.com> wrote in message news:eJ**************@TK2MSFTNGP09.phx.gbl... the following codes are error occurs. basically, I set a breakpoint at BuildingTN, I trace it, and it come
up my intended table, but when I run the program, in my component cobInside, it always displays somethings from my other table.
DataSet ds = officeAux.DSource; officeAux.DA.Fill(ds,BuildingTN);
for(int i=0;i<ds.Tables[BuildingTN].Rows.Count;i++) { this.cobInside.Items.Add(ds.Tables[BuildingTN].Rows[i].ItemArray[1]); }
does anyone know what happen??
pei
Peter Bromberg [C# MVP] <pb*******@yahoo.com> wrote: for(int i=0;i<ds.tables[buildingTN].rows.count;i++) unless buildingTN resolved to an integer value, shouldn't this be: for(int i=0;i<ds.tables["buildingTN"].rows.count;i++) -- in other words, unless buildingTN is a variable of type int, you would need to place inside quotation marks to reference an "named" table overload. Check your documentation your only problem at this point appears to be a minor syntax error.
No, if buildingTN is a string variable it'll be fine too. (I believe
that's the case here).
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
yes, BuildingTN is string type variable. what I want is that obtain two
tables into a dataset and create relation for them. but the BuildingTN
always give me the first table. don't know why table 2 is missing.
thanks
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... Peter Bromberg [C# MVP] <pb*******@yahoo.com> wrote: for(int i=0;i<ds.tables[buildingTN].rows.count;i++) unless buildingTN resolved to an integer value, shouldn't this be: for(int i=0;i<ds.tables["buildingTN"].rows.count;i++) -- in other words, unless buildingTN is a variable of type int, you would need to place inside quotation marks to reference an "named" table overload. Check your documentation your only problem at this point appears to be a minor syntax error.
No, if buildingTN is a string variable it'll be fine too. (I believe that's the case here).
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Programatix |
last post by:
Hi,
I'm working on a project which includes WebServices and Windows Form
application.
The Windows Form application will call the WebServices to retrieve data from
database. The data will be...
|
by: Programatix |
last post by:
Hi,
I'm working on a project which includes XML WebServices and Windows Form
application.
The Windows Form application will call the XML WebServices to retrieve data
from database. The data...
|
by: Bruce Stockwell |
last post by:
the setup:
Webservice/WinClient application/SQL server.
VS.Net (visual basic) winform wizard creates a simple form
with load cancel cancelall and datagrid bound to a simple
Dataset with one...
|
by: Linesh Gajera |
last post by:
Hi Guys
i having the same problem with Strongly typed dataset, I have created
a stronsetly typed dataset by draging table from Server explorer and
now i have retreived xml from SQL server 2000...
|
by: Bishoy George |
last post by:
I have a dataset called ds1 filled with 2 tables Employees and Customers
from Northwind database.
I have dropdownList called ddLastName with the following properties:
ddLastName.DataSource =...
|
by: Lars Netzel |
last post by:
A little background:
I use three Datagrids that are in a child parent relation.
I Use Negative Autoincrement on the the DataTables and that's workning nice.
My problem is when I Update these...
|
by: Arne |
last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart
from a pocket PC to a webservice.
What is the right datatype?
II have tried dataset as a datatype, but I can't get it to...
|
by: Darious Snell |
last post by:
I am using windows forms and vb.net.
My problem is a little complex so please bear with me.
I have written an application that references a .com based API linked to an external
client...
|
by: c.w.browne |
last post by:
Hi,
Ive had a bit of a look around for other people with this problem and
cant find anything that solves it in my case, so I'm afraid im going to
have to bother you all with a post of my own.
...
|
by: Ken Fine |
last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets
and DataTables should be able to answer fairly easily. The basic question is
how I can efficiently match data from one...
|
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
|
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...
|
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...
|
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...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
|
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: 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...
| | |