473,378 Members | 1,621 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,378 software developers and data experts.

IsDBNull ~ Precompiled code in .NET~Help Please

ASp.NET 2.0 , Visual Studio 2005

I am working with the Add NEw Item >DataSet
I have created my Dataset and call it, when I run my project, I receive an
error message because the dataset is pulling a DBNULL value.

I was suggestted to add the following IF ELSE and it makes sense to do that
:
<System.Diagnostics.DebuggerNonUserCodeAttribute() _

Public Property SuiteFloor() As String

Get

Try

If isDbNull(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn) Then

Return ""

Else

Return CType(Me(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn), String)

End If

Catch e As System.InvalidCastException

Throw New System.Data.StrongTypingException("The value for column
'SuiteFloor' in table 'aspnet_getCrownCorpData' is DBNull.", e)

End Try

End Get

Set

Me(Me.tableaspnet_getCrownCorpData.SuiteFloorColum n) = value

End Set

End Property

The above code looks great,

However, after saving this file >>App_Code.91dxmfxl.1.vb and ReBuilding my
Web site, I ran into the same issue.........because it seems that the
Project runs a different file named >App_Code.wyx3j.1.vb with the original
precompiled code and does not see my changes to the code:

<System.Diagnostics.DebuggerNonUserCodeAttribute() _

Public Property SuiteFloor() As String

Get

Try

Return CType(Me(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn),String)

Catch e As System.InvalidCastException

Throw New System.Data.StrongTypingException("The value for column
'SuiteFloor' in table 'aspnet_getCrownCorpData' is DBNull.", e)

End Try

End Get

Set

Me(Me.tableaspnet_getCrownCorpData.SuiteFloorColum n) = value

End Set

End Property

Is there any way around this............any ideas/ suggesttions would be
greatly appreciated.

Thanks,

~Brad
ps: It just seems stupid that you cannot adjust this code.............
------------------------------
Brad Isaacs
bi*****@rogers.com
Feb 16 '07 #1
2 1444
Hi Brad,

1. First, there's a statement at the top of generated designer dataset file,
saying that you should not change the content of the file, because changes
will be lost next time file is refreshed.
2. Second, your code won’t work because you’re checking if reference to
SuiteFloorColumn column is DBULL which is never true; it should evaluate row
value from column /or column name/column index:

Return CType(Me(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn),String)

This is what actually is rendered by Visual studio automatically.
3. Third, designer generates a special property for this type of check
IsColumnNameNUull for these types of checking. In you case it will be :

If myTypeDataDataSet.TableName.Rows[0].IsSuiteFloorColumnNull() then
End if

Hope it’s clear now

Have a nice day
--
Milosz

"Brad Isaacs" wrote:
ASp.NET 2.0 , Visual Studio 2005

I am working with the Add NEw Item >DataSet
I have created my Dataset and call it, when I run my project, I receive an
error message because the dataset is pulling a DBNULL value.

I was suggestted to add the following IF ELSE and it makes sense to do that
:
<System.Diagnostics.DebuggerNonUserCodeAttribute() _

Public Property SuiteFloor() As String

Get

Try

If isDbNull(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn) Then

Return ""

Else

Return CType(Me(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn), String)

End If

Catch e As System.InvalidCastException

Throw New System.Data.StrongTypingException("The value for column
'SuiteFloor' in table 'aspnet_getCrownCorpData' is DBNull.", e)

End Try

End Get

Set

Me(Me.tableaspnet_getCrownCorpData.SuiteFloorColum n) = value

End Set

End Property

The above code looks great,

However, after saving this file >>App_Code.91dxmfxl.1.vb and ReBuilding my
Web site, I ran into the same issue.........because it seems that the
Project runs a different file named >App_Code.wyx3j.1.vb with the original
precompiled code and does not see my changes to the code:

<System.Diagnostics.DebuggerNonUserCodeAttribute() _

Public Property SuiteFloor() As String

Get

Try

Return CType(Me(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn),String)

Catch e As System.InvalidCastException

Throw New System.Data.StrongTypingException("The value for column
'SuiteFloor' in table 'aspnet_getCrownCorpData' is DBNull.", e)

End Try

End Get

Set

Me(Me.tableaspnet_getCrownCorpData.SuiteFloorColum n) = value

End Set

End Property

Is there any way around this............any ideas/ suggesttions would be
greatly appreciated.

Thanks,

~Brad
ps: It just seems stupid that you cannot adjust this code.............
------------------------------
Brad Isaacs
bi*****@rogers.com
Feb 16 '07 #2
Hi Milosz,

Thank you very much for your help.

~Brad
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:07**********************************@microsof t.com...
Hi Brad,

1. First, there's a statement at the top of generated designer dataset
file,
saying that you should not change the content of the file, because changes
will be lost next time file is refreshed.
2. Second, your code won't work because you're checking if reference to
SuiteFloorColumn column is DBULL which is never true; it should evaluate
row
value from column /or column name/column index:

Return CType(Me(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn),String)

This is what actually is rendered by Visual studio automatically.
3. Third, designer generates a special property for this type of check
IsColumnNameNUull for these types of checking. In you case it will be :

If myTypeDataDataSet.TableName.Rows[0].IsSuiteFloorColumnNull() then
End if

Hope it's clear now

Have a nice day
--
Milosz

"Brad Isaacs" wrote:
>ASp.NET 2.0 , Visual Studio 2005

I am working with the Add NEw Item >DataSet
I have created my Dataset and call it, when I run my project, I receive
an
error message because the dataset is pulling a DBNULL value.

I was suggestted to add the following IF ELSE and it makes sense to do
that
:
<System.Diagnostics.DebuggerNonUserCodeAttribute( )_

Public Property SuiteFloor() As String

Get

Try

If isDbNull(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn) Then

Return ""

Else

Return CType(Me(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn),
String)

End If

Catch e As System.InvalidCastException

Throw New System.Data.StrongTypingException("The value for column
'SuiteFloor' in table 'aspnet_getCrownCorpData' is DBNull.", e)

End Try

End Get

Set

Me(Me.tableaspnet_getCrownCorpData.SuiteFloorColu mn) = value

End Set

End Property

The above code looks great,

However, after saving this file >>App_Code.91dxmfxl.1.vb and ReBuilding
my
Web site, I ran into the same issue.........because it seems that the
Project runs a different file named >App_Code.wyx3j.1.vb with the
original
precompiled code and does not see my changes to the code:

<System.Diagnostics.DebuggerNonUserCodeAttribute( )_

Public Property SuiteFloor() As String

Get

Try

Return CType(Me(Me.tableaspnet_getCrownCorpData.SuiteFloo rColumn),String)

Catch e As System.InvalidCastException

Throw New System.Data.StrongTypingException("The value for column
'SuiteFloor' in table 'aspnet_getCrownCorpData' is DBNull.", e)

End Try

End Get

Set

Me(Me.tableaspnet_getCrownCorpData.SuiteFloorColu mn) = value

End Set

End Property

Is there any way around this............any ideas/ suggesttions would be
greatly appreciated.

Thanks,

~Brad
ps: It just seems stupid that you cannot adjust this code.............
------------------------------
Brad Isaacs
bi*****@rogers.com

Feb 16 '07 #3

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

Similar topics

0
by: Stephen | last post by:
I was wondering if someone could please help me with an array I'd like to create in an asp.net page. I have to design an array which stores the values of addresses manually entered into textboxes...
8
by: kittykat | last post by:
Hi, could someone please check my code? its asking the user to enter 3 letters, and check to see if these letters exist in the text file. i know ive done something wrong. can someone fix my code...
9
by: hope | last post by:
Hi Access 97 I'm lost on this code please can you help ================================= Below is some simple code that will concatenate a single field's value from multiple records into a...
4
by: Terencetrent | last post by:
I having been using Access '97/2002 for about 4 years now and have never really had the need or the time to learn visual basic. Well, I think the time has finally come. I need help with Visual...
4
by: Trint Smith | last post by:
How can I improve this code please? It sometimes produces this error: "Object reference not set to an instance of an object" When I do this: strSQL = "UPDATE TBL_Items SET" & _ " item_itemnumber...
4
by: Brian Piotrowski | last post by:
Hi All, I'm wondering if a fresh set of eyes can help me with this program. In my program, it queries an iSeries database to retrieve a code and count for a series of records. When I run the...
9
by: H. Dederichs | last post by:
Hello NG, I would like to read and write Outlook PST-Files with my VB.NET application natively. Is there anyone who can help me with this issue? Since PST-Files are "also" Databases, aren't...
3
by: Coby Herd | last post by:
I keep getting the error message - Error Type: Microsoft JET Database Engine (0x80004005) Unrecognized database format 'c:\inetpub\wwwroot\blog\db\blog.mdb'. /blog/admin/Default.asp, line 14 ...
8
by: rocketboy2000 | last post by:
could anyone provide me with some simple example code of asp classic calling adodb? specifically, i'd like the code to: - call a couple of stored procedures that have optional parameters - share a...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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 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.