In a Typed Dataset, is there a way on the xs:keyref tag that I can specify
how to handle null child objects?
For example, if I have an Invoice table, where a ClientID key is used to
create a reference to a Clients Table by it's ID Column. On the Clients
table I have a Name element.
In the calling code I do :
x = myInvoice.Reference
x = myInvoice.Amount
x = myInvoice.Rate
x = myInvoice.Client.Name
this will throw an error if, for whatever reason, the Client does not exist.
How can I get it to return an empty string instead of having to do :
If Not myInvoice.Client = Nothing Then
x = myInvoice.Client.Name
else
x = ""
End If 4 1012
A trck I always use is this:
x = myInvoice.Client.Name & ""
Hth,
Martin
"Andrew" <an*****@nospam.dbasplus.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... In a Typed Dataset, is there a way on the xs:keyref tag that I can specify how to handle null child objects?
For example, if I have an Invoice table, where a ClientID key is used to create a reference to a Clients Table by it's ID Column. On the Clients table I have a Name element. In the calling code I do : x = myInvoice.Reference x = myInvoice.Amount x = myInvoice.Rate x = myInvoice.Client.Name this will throw an error if, for whatever reason, the Client does not
exist. How can I get it to return an empty string instead of having to do :
If Not myInvoice.Client = Nothing Then x = myInvoice.Client.Name else x = "" End If
Thanks for the reply Martin, but that still throws and exception because
myInvoice.Client is Nothing.
Or am I missing something?
"Martin" <am*******@nospam.hotmail.com> wrote in message
news:uG*************@TK2MSFTNGP12.phx.gbl... A trck I always use is this:
x = myInvoice.Client.Name & ""
Hth, Martin
"Andrew" <an*****@nospam.dbasplus.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... In a Typed Dataset, is there a way on the xs:keyref tag that I can
specify how to handle null child objects?
For example, if I have an Invoice table, where a ClientID key is used to create a reference to a Clients Table by it's ID Column. On the Clients table I have a Name element. In the calling code I do : x = myInvoice.Reference x = myInvoice.Amount x = myInvoice.Rate x = myInvoice.Client.Name this will throw an error if, for whatever reason, the Client does not exist. How can I get it to return an empty string instead of having to do :
If Not myInvoice.Client = Nothing Then x = myInvoice.Client.Name else x = "" End If
No, you're not missing anything, I did.
I missed the 'Client' in between the dots.
In this case, sorry but I don't know any other way than to test if client =
nothing...
"Andrew" <an*****@nospam.dbasplus.com> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl... Thanks for the reply Martin, but that still throws and exception because myInvoice.Client is Nothing. Or am I missing something?
"Martin" <am*******@nospam.hotmail.com> wrote in message news:uG*************@TK2MSFTNGP12.phx.gbl... A trck I always use is this:
x = myInvoice.Client.Name & ""
Hth, Martin
"Andrew" <an*****@nospam.dbasplus.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... In a Typed Dataset, is there a way on the xs:keyref tag that I can specify how to handle null child objects?
For example, if I have an Invoice table, where a ClientID key is used
to create a reference to a Clients Table by it's ID Column. On the
Clients table I have a Name element. In the calling code I do : x = myInvoice.Reference x = myInvoice.Amount x = myInvoice.Rate x = myInvoice.Client.Name this will throw an error if, for whatever reason, the Client does not exist. How can I get it to return an empty string instead of having to do :
If Not myInvoice.Client = Nothing Then x = myInvoice.Client.Name else x = "" End If
What if you just did
Try
x = myInvoice.Client.Name
Catch
x = ""
End Try
It's essentially the same thing, but you won't have to check for Client =
Nothing. I'm not sure if this is faster than your way, though.
-J
"Andrew" <an*****@nospam.dbasplus.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... In a Typed Dataset, is there a way on the xs:keyref tag that I can specify how to handle null child objects?
For example, if I have an Invoice table, where a ClientID key is used to create a reference to a Clients Table by it's ID Column. On the Clients table I have a Name element. In the calling code I do : x = myInvoice.Reference x = myInvoice.Amount x = myInvoice.Rate x = myInvoice.Client.Name this will throw an error if, for whatever reason, the Client does not
exist. How can I get it to return an empty string instead of having to do :
If Not myInvoice.Client = Nothing Then x = myInvoice.Client.Name else x = "" End If
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Frame |
last post by:
I'm looking for tutorials or articles considering HTML Frames and how to
handle them with Javascript.
E.g. samples how Frames can exchange information, can a Frame instruct
other Frame to update...
|
by: scsharma |
last post by:
Hi,
I am working on creating a webapplication and my design calls for creating
main webform which will have menu bar on left hand side and a IFrame which
will contain all the forms that are shown...
|
by: krishna |
last post by:
Hi,
I have doubt in MDI forms
genarally we will set formname.MdiParent=me in the mdi
form if it is child but my doubt is when i open another
child in the child form of the mdi form it is...
|
by: Ambica Jain |
last post by:
I have a data grid called Files, which has some columns like FileName, Col1,
Col2, ... , Col8. Then i have a combobox which allows user to select from
Col1 to Col8 and based on this selection, i...
|
by: sutphinwb |
last post by:
Hi - This could be a simple question. When I relate two tables in a
datasetet, how do I get that relation to show up in a GridView? The
only way I've done it, is to create a separate table in the...
|
by: Hexman |
last post by:
Hello All,
What I'm trying to do is update a child record using a parent-child relation. I want to find out if it is faster than than doing multiple selects.
Anyways, I've created a dataset...
|
by: Ginger Estherskip |
last post by:
I'm setting up a dataset using the GUI to have a Parent Data Table and a few
Child Data Tables.
I then have a form that uses that dataset, and I can fill the appropriate
datatables et. al., but...
|
by: Valery |
last post by:
In the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<Plcy service="ILiability" boId ="LifePolicy, 1">
<Prem service="IPremium" boId ="RegularPremium, 1"></Prem>
<L1...
|
by: Rafe |
last post by:
Hi,
I've been thinking in circles about these aspects of Pythonic design
and I'm curious what everyone else is doing and thinks. There are 3
issues here:
1) 'Declaring' attributes - I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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: 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: 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: 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,...
|
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...
|
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: 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...
| |