473,395 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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,database2 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 1361
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,database2 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.com> wrote in message
news:9R***************@newsfep3-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,database2 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).DefaultView.(0).FieldName".Trim) Is System.DBNull.Value 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,database2 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,database2 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
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...
4
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...
1
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...
3
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...
4
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...
4
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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
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...
0
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
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...

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.