Hi all,
I have a dataset which I pass back from my webservice to my app.
In my webservice, it looks like this:
ds.Tables["StudentTestpaper"]
I want to access the datatable in my dataset in my app after it has received
the dataset.
How do I do this ? I tried:
int intTest = (int)ds.Tables["StudentTestpaper"].Rows[0][0];
DateTime strDT2 = (DateTime)ds.Tables["StudentTestpaper"].Rows[0][8];
This doesn't work.
TIA,
andrew 5 1140
what's the error?
Eliyahu
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com... Hi all,
I have a dataset which I pass back from my webservice to my app. In my webservice, it looks like this: ds.Tables["StudentTestpaper"]
I want to access the datatable in my dataset in my app after it has received the dataset. How do I do this ? I tried: int intTest = (int)ds.Tables["StudentTestpaper"].Rows[0][0]; DateTime strDT2 = (DateTime)ds.Tables["StudentTestpaper"].Rows[0][8];
This doesn't work.
TIA, andrew
The error message:
Object reference is not set to an instance of an object.
Thanks
"Eliyahu Goldin" wrote: what's the error?
Eliyahu
"Andrew" <An****@discussions.microsoft.com> wrote in message news:93**********************************@microsof t.com... Hi all,
I have a dataset which I pass back from my webservice to my app. In my webservice, it looks like this: ds.Tables["StudentTestpaper"]
I want to access the datatable in my dataset in my app after it has received the dataset. How do I do this ? I tried: int intTest = (int)ds.Tables["StudentTestpaper"].Rows[0][0]; DateTime strDT2 = (DateTime)ds.Tables["StudentTestpaper"].Rows[0][8];
This doesn't work.
TIA, andrew
ok, something in your reference doesn't exist. The dataset? The table? The
row? The cell? If you set a breakpoint, you should find out what is missing.
Could be there is a problem in the way how you pass the dataset in the
webservice?
Eliyahu
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:F8**********************************@microsof t.com... The error message:
Object reference is not set to an instance of an object.
Thanks
"Eliyahu Goldin" wrote:
what's the error?
Eliyahu
"Andrew" <An****@discussions.microsoft.com> wrote in message news:93**********************************@microsof t.com... > Hi all, > > I have a dataset which I pass back from my webservice to my app. > In my webservice, it looks like this: > ds.Tables["StudentTestpaper"] > > I want to access the datatable in my dataset in my app after it has > received > the dataset. > How do I do this ? I tried: > int intTest = (int)ds.Tables["StudentTestpaper"].Rows[0][0]; > DateTime strDT2 = (DateTime)ds.Tables["StudentTestpaper"].Rows[0][8]; > > This doesn't work. > > TIA, > andrew
You need to break it down:
DataTable dt = ds.Tables[0];
if(null!=dt)
{
DataRow dr = dt.Rows[0];
if(null!=dr)
{
//// you get the drill
}
}
With all the ordinal stuff, you might want to consider creating a strongly
typed DataSet
...
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com... Hi all,
I have a dataset which I pass back from my webservice to my app. In my webservice, it looks like this: ds.Tables["StudentTestpaper"]
I want to access the datatable in my dataset in my app after it has
received the dataset. How do I do this ? I tried: int intTest = (int)ds.Tables["StudentTestpaper"].Rows[0][0]; DateTime strDT2 = (DateTime)ds.Tables["StudentTestpaper"].Rows[0][8];
This doesn't work.
TIA, andrew
Thanks for your replies.
I changed the code to:
int aa = (int)ds.Tables[0].Rows[0][0];
DateTime strDT2 = (DateTime)ds.Tables[0].Rows[0][8];
It seems that ds.Tables["StudentTestpaper"] is not the same as ds.Tables[0]
, hmm...... I am sure that I populated my dataset in my webservice with
["StudentTestpaper"].
regards,
andrew
"sloan" wrote: You need to break it down:
DataTable dt = ds.Tables[0]; if(null!=dt) { DataRow dr = dt.Rows[0]; if(null!=dr) { //// you get the drill } }
With all the ordinal stuff, you might want to consider creating a strongly typed DataSet
...
"Andrew" <An****@discussions.microsoft.com> wrote in message news:93**********************************@microsof t.com... Hi all,
I have a dataset which I pass back from my webservice to my app. In my webservice, it looks like this: ds.Tables["StudentTestpaper"]
I want to access the datatable in my dataset in my app after it has received the dataset. How do I do this ? I tried: int intTest = (int)ds.Tables["StudentTestpaper"].Rows[0][0]; DateTime strDT2 = (DateTime)ds.Tables["StudentTestpaper"].Rows[0][8];
This doesn't work.
TIA, andrew This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bill C. |
last post by:
Hi,
I've got a simple console app that just reads an XML file into a DataSet
then prints out a description of each table in the DataSet, including
column names and row values for each column. ...
|
by: Mike |
last post by:
I need to expand the DataSet class by inheriting from it and adding
functions that work on the data in the tables. However, since I can't
upcast how can I get my base DataSet object assigned an...
|
by: John Holmes |
last post by:
I have a web interface where the user types in ID's one at a time. After an
ID is typed in, a button is clicked and the button click event has code that
does a query and returns a data reader and...
|
by: Darren Clark |
last post by:
I have a data set... in which i need to remove 1 row based on a particaly
name
eg
i have a data set (data) and it has 1 table and N rows.... It has a column
name of
i want to remove all...
|
by: PAPutzback |
last post by:
I have a form that when it loads it fires off a second thread to load a
datatable. This datatable contains a list of names and ids that the user
may want to add to their criteria. So I have a...
|
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: matt |
last post by:
hello,
i have a web app that allows users to query our oracle db and produce a
dataset of report data. they then have the option to serialize this
data and store it in the database. later, then...
|
by: SmartbizAustralia |
last post by:
Hi,
This seems to be a neglected bit of info as everyone gets carried away
with data binding examples instead.
Can simply use the datareader as below:
Private Sub PopulateControls1()
Dim...
|
by: x5Rb |
last post by:
Database: 2 parent tables + 1 child table (child of both parent tables), enforcing foreign key constraints
App: winformsapp, stuff (dataset, datatables, tableadatpers) generated by designer
...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |