.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

When Null value is returned causes errors ?

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net

I've read in a few places, that when a database returns a "null" value (ie. Nothing) that it can cause a host of errors and throw errors....


So is there anyway to set (in a global file or web.config) that anytime a "null" is encountered that it would not throw a wobbly?


And/or is this necessary?

View Complete Post

More Related Resource Links

Access Denied and Null Returned while Accessing Web Services from remote server.

Please go through following scenario.  I am writing a web Service and one of its web method, I want it to download a png file in form of buffer from remote server. And My consume application will write that buffer retured by Web service in to file on User's Computer. However, I am able to do this using Local Web Service but when I published that service on my web server, I always get null retuned And even in one of my test code while copying file from that server , I always get Access Denied.  Following things I have done for above issue. 1] I even tried making the Anonymous user for the web service the system administrator (with the correct password), to no avail. 2] I also tried sharing out the folder I'm pulling files from to allow access from Everyone.   [Previously same service was working fine on another remote server with IIS 7.0, we checked server IIS Settings but in vain.]   if you know where we are mistaken please guide me to resolve this issue as its very urgent. Please go through following scenario.                  

Desired rows not returned because of null values


I have a property table and an image table.
I want this query to return all distinct properties and a thumbnail image. However some properties don't have thumbnail images and they
don't get returned by the query. If the imgid is null I still want to return the property. Not sure of how to do this. Thanks

ALTER PROCEDURE dbo.procGetPropertiesSelect2
SELECT        tblProperty.PropertyID, tblProperty.SubmitPersonKey, tblProperty.SubmitDate, tblProperty.Active, tblProperty.PropName, tblProperty.StreetAddress1, tblProperty.Storage,
FROM            tblProperty INNER JOIN
                         tblPropertyImages ON tblProperty.PropertyID = tblPropertyImages.PropertyKey
WHERE        (tblProperty.PropNa

SSIS excel data source numeric values returned as null

Hello everyone, long time no see!, I have a problem and was hoping someone can help me:
I'm using SSIS 2005 Enterprise edition,  I'm creating a package that reads an excel (xls) file using the "excel source" component, and it dumps the data into an OLEDB destination (a sql server).
When I drag the excel source component and create the excel connection to my file the component automatically reads the columns and their datatypes.

The problem is that I have a column which has numeric data and the package uploads as NULL every number that starts with a zero. (note: in excel this column is formatted as "text", despite it has only numbers, because it's the only way excel maintains the left sided zeros).
So I checked the data types by right clicking the excel source component -> show advanced editor and my surprise is that this column's data type is detected as double-precision float, and it doesn't let me change it.

I tried the answer posted here: http://devselekta.blogspot.com/2007/09/ssis-excel-data-source-values-returned.html but it only works when the first row of data has a number beginning with zero on this column.
Someone knows how to get the data imported correctly? Thanks in advance.

How do display null rows returned from my table valued function?

DECLARE @techNumLoop VARCHAR(25)
 Tech Varchar(25) 
,Item_Count Integer NULL 
,Expenses MONEY NULL

SELECT DISTINCT t.Case_Number Tech
FROM tblTechnology t
OPEN techCursor;
FETCH NEXT FROM techCursor INTO @techNumLoop;
INSERT @myTemp
FROM ufn_Find_Some_Stuff(@techNumLoop)


Search crawl extended by several hours but returned no errors.


My ssp ran a full crawl last night for 8 hours before stopping this morning. It normally takes 15 to 20 minutes. Looking at the Recently Completed Crawls in the SSP admin page, the number of items has stayed about the same and there have been no errors in this week or any of the previous logs. Yet the last run took drastically longer.

I'm not very adept at dealing with the logs. With there not being any errors to point to in the log itself, where is the next place to look for causes?


OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Syntax error


Hi there.

I have been sitting hours and hours trying to solved this issue with absolutely no luck.

I have the following query:

Code Snippet

DECLARE @sqlScript1 VARCHAR(8000)

-- Import records fron source file (OPENROWSET)

SET @sqlScript1 = 'SELECT * INTO ##tmpOrders FROM OPENROWSET(''Microsoft.Jet.OLEDB.4.0'' ,

''Excel 8.0;Database=' + @fileName + ''', ''SELECT [Sale Time] AS SaleTime, Ref, [Item Title] AS ItemTitle, [Item Type] AS ItemType, [Item Id] AS ItemId,


Javascript errors "null or not an object" and "Could not complete the operation due to error 8007fff


I am getting several javascript errors that I haven't been able to fix. So far, searched have proved fruitless...

We first noticed the problem on 3/31/2011 when we were updating some pages. 

I got a call from one of my power users that a webpart was "locked" and couldn't be opened.  When you first browse to the page, everything looks okay.  When you click on the dropdown to open the menu to modify the webpart, an "Error on page." message shows up in the lower left of the IE browser. 

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
Timestamp: Fri, 1 Apr 2011 17:14:07 UTC

Message: 'style.display' is null or not an object
Line: 2134
Char: 4
Code: 0
URI: http://rtshare/_layouts/1033/ie55up.js?rev=Ni7%2Fj2ZV%2FzCvd09XYSSWvA%3D%3D

I copied the contents of the web part (content editor web part) and pasted it into a new web part.  I killed the old one by opening up Web Part Page Maintenance page "?contents=1".  That got rid of the web part that was acting up.  It turns out, there is a larg

How can I be sure that my entire project is up-to-date and free of errors in VS2010?


Seems like a stupid question, but I will go to Build > Build Solution many many times and the build will succeed many many times, then I will put in a minor syntax error and the build will fail, BUT the build will not fail because of the minor syntax error; it will fail because of an unresolved type that I put in about twenty compiles ago. And then I will fix the minor syntax eror, and the compiler will still complain about the unresolved type. Here is my code:

<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
  <form runat="server">
  Hello World!!  

Pretty simple, really. I go to Buld > Build WebApplication1 and it runs OK. Now, if I put in a minor syntax error, such as substitute "forrrrrrrm" for "form" and then try to Build Solution, it complains not about the misspelled word, but about the FreeTextBox. And then if I correct the misspelled wird, it still complains about the FreeTextBox. Which leads me to believe that Building the Solution does not check absolutely 100% everything that needs to be checked. Is there a more thorough way of compiling a program that I need to use?

How to check for null/empty strings on dynamic objects?


What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:

if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)

If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?

Where to Filter the companies returned by the EF?



I am just starting with dynamic data. I have an enttity framework called UsersModel.edmx.

It returns a list of all companies in the tblCompany table. This list is really big.

I need to filter the list returned to all user controls on the client so that it only returns the company that have a CompanyTypeId= 2 or CompanyTypeId= 3 and company name != "".

1 - Is it possible to filter the company list returned on the server so that I can filter only once for all the controls that use that on the client?

My ideas was to do something like this using linq and lambda but I am not sure how:

return tblCompanys.Where(c => c.CompanyTypeId == 2 || c.CompanyTypeId == 3 && ).Where(c=>c.CompanyName != "").OrderBy(c => c.CompanyName).Distinct().OrderBy(c=>c.CompanyName);

2 - I have created a partial class and a metadata class and added the DisplayColumn attribute to use the company name and sort by company name ascending.

Could I use the code to filter the returned companies in this? where?

namespace MarsMedicalModel
    [DisplayColumn("CompanyName", "CompanyName")]
    public partial class t

Users getting logged out because HttpContext.Current is null


We've  been trying to fix this one for a couple years, and I'm just out of ideas, so any help is really appreciated!

We've got a fairly large, complex web application that uses Forms Authentication to authenticate users.  Throughout the application we store and retrieve information about users in the Session object, and in some cases in cookies.  In a couple places we check for the existence of the context, and if it's null we send the user back to the login page to re-establish the session. 

Just a quick run-down of this web app: C#, .NET 3.5, IIS 6, ASP.NET State Service to manage session

As for the session timer, we use our own home-grown timer, which is basically a client-side timer, which is backed up by a check to the SQL database to see when their last activity was.  This seems to work well for us.  It's not perfect, but it allows us to notify the user before the session times out, and allows us to be certain we're not logging a user out before their 60 minutes of inactivity is up.

What's happening is that certain users are being logged out after just a few minutes.  We've eliminated the timer as a cause and believe what's happening is the HttpContext.Current is null, so the user is logged out.  We do not know why the HttpContext.Current is null, and I underst

Word Automation - Multiple DCOM Errors/Behavior

Before I get started, I already know that Microsoft does not support and highly discourages server-based MS Office automation.  I've read a multitude of posts and smarmy "*wink*, here's a link" replies, so I'm looking for actual help here, not condescending reprimands.

That notwithstanding, here is my problem.  I have developed a simple method that will open a local Word document, modify some header information, and then save the document as a new file.  As expected, it works great as a console/windows app, but as soon as I went to ASP.NET, DCOM jacked my world up when accessing the app remotely from a different domain account (that has access to the ASP.NET app.  For reference, my method is shown below:


1    public static string ModifyAndSaveBuildDocument(string localFilePath, BuildDocumentType docType, string buildNumber, DateTime buildDate, string projectName)
2            {
3                try
4                {
5                    ProjectConfiguration config = (ProjectConfiguration)ConfigurationManager.GetSection("ProjectConfiguration");

'element.className' is null or not an object



I just downloaded the project, compiled it and ran it right out of the box and when I put the mouse pointer over or remove the mouse pointer from either MenuItem in the menu demo, I generate this error:

'element.className' is null or not an object

It points to this javascript method:

updateClassName: function(operation, element, name, value) {
        this[operation + 'String'](
                function() {
                    return element.className;
                function(newValue) {
                    element.className = newValue;

Toolbox: Logging Web App Errors, Learning LINQ, and More


See how to log Web application errors for better health monitoring, what to read if you're thinking about LINQ, and which blog Scott recommends reading this month.

Scott Mitchell

MSDN Magazine April 2008

Enterprise Library: Take Exception To Critical Errors With Custom Application Blocks


Enterprise Library is a collection of application functionality blocks that you can re-use in your application for common functionality you'd otherwise have to write again and again. Here Jay Hilyard explains how to use them.

Jay Hilyard

MSDN Magazine September 2006

Toolbox: Synchronize Data, Review Runtime Errors, and More


This month we bring you products that let you synchronize data, correct runtime errors, and more.

Scott Mitchell

MSDN Magazine August 2006

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend