473,545 Members | 2,051 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

isDBNull() on two tables

how to i use isdbnull on two tables ?

im pulling out the data with a stored procedure like this :-

CREATE PROCEDURE search

@search varchar(8)

AS

Select * from databasel,datab ase2 where database1.ID = @search and
database2.ID = @search

GO

i need to check if a field is null which i do by

If objDR.IsDBNull( 1) Then
field1.Text() = ""
Else : field1.Text = objDR("field1")
End If
but how do i do this over two tables ???
cheers
mark

Nov 18 '05 #1
5 1366
I am not sure I know what the problem is. IsDBNull works regardless of the number of tables you join

Tu-Thac

----- luna wrote: ----

how to i use isdbnull on two tables

im pulling out the data with a stored procedure like this :

CREATE PROCEDURE searc

@search varchar(8

A

Select * from databasel,datab ase2 where database1.ID = @search an
database2.ID = @searc

G

i need to check if a field is null which i do b

If objDR.IsDBNull( 1) The
field1.Text() = "
Else : field1.Text = objDR("field1"
End I
but how do i do this over two tables ??
cheer
mar


Nov 18 '05 #2
The two tables issue is irrelvant, one select statement, one data source.
Aside from that, what are you trying to accomplish with that sql statement?
I think I know what you are after, a search of many tables for one element,
you may want to look at the UNION operator in sql server.

"luna" <lu**@themoon.c om> wrote in message
news:9R******** *******@newsfep 3-gui.server.ntli .net...
how to i use isdbnull on two tables ?

im pulling out the data with a stored procedure like this :-

CREATE PROCEDURE search

@search varchar(8)

AS

Select * from databasel,datab ase2 where database1.ID = @search and
database2.ID = @search

GO

i need to check if a field is null which i do by

If objDR.IsDBNull( 1) Then
field1.Text() = ""
Else : field1.Text = objDR("field1")
End If
but how do i do this over two tables ???
cheers
mark

Nov 18 '05 #3
First, are you retriving this data into a dataset?

If so, then you would have to do something like
If Not DataBinder.Eval (sDataSet, "tables(0).Defa ultView.(0).Fie ldName".Trim) Is System.DBNull.V alue The
....
End I

I hope i understood your questions and directed you in the right direction

Regard
Shahra
----- luna wrote: ----

how to i use isdbnull on two tables

im pulling out the data with a stored procedure like this :

CREATE PROCEDURE searc

@search varchar(8

A

Select * from databasel,datab ase2 where database1.ID = @search an
database2.ID = @searc

G

i need to check if a field is null which i do b

If objDR.IsDBNull( 1) The
field1.Text() = "
Else : field1.Text = objDR("field1"
End I
but how do i do this over two tables ??
cheer
mar


Nov 18 '05 #4
luna wrote:
how to i use isdbnull on two tables ?

im pulling out the data with a stored procedure like this :-

CREATE PROCEDURE search

@search varchar(8)

AS

Select * from databasel,datab ase2 where database1.ID = @search and
database2.ID = @search

GO

i need to check if a field is null which i do by

If objDR.IsDBNull( 1) Then
field1.Text() = ""
Else : field1.Text = objDR("field1")
End If
but how do i do this over two tables ???
cheers
mark

Mark,
If I understand correctly yr having problems cos' the field names
are the same name. The datareader doesnt care if you have 1 or n tables,
all it gets to see are the fields that are in the collection. I think
you should be fine if you alias the fields.
--
Regards,
Dilip Krishnan
dilip removethis @ msn.com
Nov 18 '05 #5
thanks for the suggestions

im basically pulling out all the data from two tables and populating a form
i thought i could retrieve all the data with one while / end while block
but currently i have to use 2 - i was trying to tighten up the code by
pulling out both sets of data in the same while/ end while
i was asking about isdbnull() as im having to use the ordinal number -
im not sure of the ordinal number for the second set of data ? - or does it
just follow on ?
Nov 18 '05 #6

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

Similar topics

19
3578
by: jim | last post by:
This line of code returns error 13, cast from 'DBNull' to type 'String' is not valid If IsDBNull(Clinics.Clinics.Item(A).Workphone) The <other code End I Clinics.Clinics is a dataset that was loaded using a left join from two MS SQL database tables. The workphone element is null because there was no corresponding record from the right...
4
3436
by: Jim | last post by:
I am having a problem with the IsDBNull function. When it checks what type of value is contained in the parameter that is passed to it, it does not successfully determine that it has a DBNull value. If I access the value of what I am going to pass to the IsDBNull function before I call the IsDBNull function then it does successfully...
1
3184
by: et | last post by:
How do you know when to use isnull, and isdbnull and how do you use them? I have the following expression in C: DataRowView drv = dataItem as DataRowView; if (drv != null) How do I convert this to VB? By using intellisense, the only option I have is isdbnull(drv), but it's not a database, and there is no option for drv.isnull or...
3
3577
by: Paul D. Fox | last post by:
I have this code snippet below where I'm loading all the labels based upon the retrieved record from the DataReader. Unfortunatley, some of the values are null, so I can't explicitly set the labels without checking first. Is there a better method to write this than using a bunch of "If" statements? Could it be a function? if so, how would I...
4
4004
by: sck10 | last post by:
Hello (converting from vb to c#), Is there a way to test the value of null of a particular field of a dataset from SQL Server? I am going through a dataset and trying to determine if the value being sent is Null using IsDBNull. I am using the following: if (! IsDBNull(spCurrentHighLgt)) this.ltlCHLTitle.Text =...
4
4081
by: Brad Isaacs | last post by:
I am using ASP.NET 2.0 codebehind Visual Basic, Visual Studio 2005 Working with DataSet creating a Data Access Layer via VS 2005. My error is when the code that is prewritten by VS 2005 Casts to String but the data inside the column is a NULL. Code prewritten by visual studio: <System.Diagnostics.DebuggerNonUserCodeAttribute()_
5
6860
by: Rainer Queck | last post by:
Hello NG, I have a typed dataset, where I want to check the column of a datarow if it is DBNull. How can the following code cause an Exception (what is does): if (Convert.IsDBNull(myDataRow.vrAbarbeitung)) { .... }
0
7409
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7664
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. ...
1
7436
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...
0
7766
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5981
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5341
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...
0
4958
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1897
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
0
715
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...

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.