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

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

Giving me an error "Object reference not set to an instance of an object."

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
Hello Everyone, I am currently developing a website for online examination.  For that I have to collect user information at the time of registration. I want to develop a 3-tier application. I have SignUpWizard. Aspx page. I have also created 3 classes (Users.cs, UserDAL.cs and UserBAL.cs) and 1 stored procedure (InsertUserInfo).Code for Users.cs:using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Configuration; using System.Data.SqlClient; using System.Web.Security; using System.Data; namespace ITIL.DomainModels { public class Users { public int UserID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Username { get; set; } public string Password { get; set; } public string EmailAddress { get; set; } public string dateTime { get; set; } public string IPAddress { get; set; } public string SecurityQuestion { get; set; } public string SecurityAnswer { get; set; } } }Code for UserDAL.cs:using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.SqlClient; using System.Configuration; using ITIL.DomainModels; namespace ITIL.DAL { public class UserDAL { publi

View Complete Post

More Related Resource Links

Json Deserialization is giving error in IronPython



Have anyone tried json deserialization. When I tried:

>>> import json

>>> json.loads('["foo", {"bar":["baz", '"Test", 1.0, 2]}]')

I got following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\json\__init__.py", line
 307, in loads
  File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\json\scanner.py", line
42, in iterscan

HoverMenuExtender is giving me the error SYS.Extended.UI.PositioningMode.Aboslute is null or not an


Here is my Code....Any thoughts on what I am doing wrong? I pulled in the Ajax Tookit based on the instructions then was following the HoverMenuExtender tutorial.

Any info would be greatly apprecated!

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
<asp:ScriptManager ID="asm" runat="server" />
      <asp:Repeater ID="rpOrders" runat="server">
          <br />
          <asp:Panel ID="myPanel" runat="server" Width="400px" BackColor="Lime" BorderWidth="1px">
              <%#DataBinder.Eval(Container.DataItem, &quo

SSIS Package working on SQL Client Machine but when trying to run on SQL Server machine giving error

Hi We are trying to run SSIS package on sql server machine but sometimes it is giving error for data flow task containing Script Component. Error is - [SSIS.Pipeline] Error: component "SCR DimensionRelation" (1) failed the post-execute phase and returned error code 0x80004002. This error is not coming continuously. And also not for specific DFT. It comes for different DFTs as we rerun the package. Can anybody help me on this? We are using SQL server 2008. We are not getting any error on client machine :(:(

mdx case giving #error

Basically I am trying to sum the NewCount across product &1 &2 .  If I remove NewCount and replace it standard Count I am able to get the results...guessing it's the way the cell are summed.  Any help will be great ! Thanks.    with MEMBER Measures.[NewCount] as format ( case        when [Dim Product].currentMember is [Dim Product].&[0] then Measures.[Count] * 1.24        when [Dim Product].currentMember is [Dim Product].&[1] then Measures.[Count] * 2.66        else 0      end   , "#" )  select     [Dim Date].[Year].[2009] on 0 ,  Measures. [NewCount] on 1  from   [DemoCube]   where   { [Dim Product].&[1], [Dim Product].&[2] }  

Object reference not set to an instance of an object error.

i've installed the VSeWSS.msi on VS 2005, i'm using SPS 2007, i'm developing on my workstation in C#, i've added the Mircosoft.Sharepointserver dll reference to my project but i still can't deploy a very basic webpart. i get the "Object reference not set to an instance of an object" error but there's no reference to a line, column, project or anyhting. very frustrating. any suggestions/links whould be appreciated.

Login error - Object reference not set to an instance of an object.

Hi all,I've set up the login section as a user control. WheneverI log in I get a "Object reference not set to an instance of an object", with the code stopping on this line: if (Membership.ValidateUser(txtUserName.Text,txtPassword.Text))Can anyone tell me how to fix this please?protected void LoginButton_Click(object sender, EventArgs e) { TextBox txtUserName = loggedin.FindControl("UserName") as TextBox; TextBox txtPassword = loggedin.FindControl("Password") as TextBox; CheckBox ckbRememberMe = loggedin.FindControl("RememberMe") as CheckBox; if (Membership.ValidateUser(txtUserName.Text,txtPassword.Text)) { FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, ckbRememberMe.Checked); } else { // Msg.Text = "Login failed. Please check your user name and password and try again."; } } <asp:LoginView ID="loggedin" runat="server"> <AnonymousTemplate> <asp:Login ID="Login1" runat="server"> <LayoutTemplate> <table id="mainbox" width="400"> <tr> <td width="150" class="label">

Validation.Error giving strange behavior

I'm seeing some weird behavior with the Validation.Error attached event. I have a textbox bound to an object that implements the IDataErrorInfo interface. The textbox subscribes to the Validation.Error event. What is weird is that when you put the text box into an invalid state, the Validation.Error event gets triggered twice. Under .NET 3.5, the first time ValidationErrorEventArgs.Action == Removed. The second time ValidationErrorEventArgs.Action == Added. Under .NET 4, it's reversed. The first time ValidationErrorEventArgs.Action == Added. The second time ValidationErrorEventArgs.Action == Removed. Why would it be called twice and why would it work differently under .NET 3.5 and .NET 4? I'm trying to implement a validation summary control similar to the one from ASP.NET. There is a solution here: http://codeblitz.wordpress.com/2009/05/12/wpf-validation-summary-control/ but it doesn't work under .NET 4 because in order for it work work, when you put a control into an invalid state, the last call to the Validation.Error event has to be with ValidationErrorEventArgs.Action == Added. Here is my code:   <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplicatio

Error while export to pdf-Object reference not set to an instance of an object

Hello, I am getting error while rendering the report to pdf in SSRS 2008. This is happening randomly and sometimes I get this error. I have SQL Server 2008 SP1 installed in my system . I installed the cumulative update 1 for SP1 also but no luck. Every time when export to pdf fails, SSRS is creating the dump file in the logs. I have captured the log of this specific error. Please let me know if you have any idea about this.   reportrendering!ReportServer_0-297!1ec4!03/30/2010-10:32:57:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report., ; Info: Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report. ---> Microsoft.ReportingServices.OnDemandReportRendering.ReportRenderingException: An error occurred during rendering of the report. ---> System.NullReferenceException: Object reference not set to an instance of an object.   at Microsoft.ReportingServices.Rendering.HPBProcessing.Paragraph.get_SpaceBefore()   at Microsoft.ReportingServices.Rendering.RichText.LineBreaker.FlowParagraph(Paragraph paragraph, Directions direction, IntPtr hdc, Single dpiX, FontCache fontCache, FlowContext flowContext, Boolean keepLines, SizeF flowContextSize, Int32& contentOffset)   at Mi

A customized EditForm.aspx page giving error because it has a "People and Group" field with a "Allow

My customized EditForm.aspx which has a "People and Group" column with the "Allow multiple selections" property as "Yes" was working fine until the Agusust cumulative update was applied into the MOSS server. Now it's giving me the error: "An unexpected error has occurred". Needless to say, when I change the "Allow multiple selections" property to "No", the customized EditForm.aspx page works fine.Forgetting whyMicrosoft introduced this error for now, is there a workaround that you are awre of?

Help with Object reference not set to an instance of an object. error.

I was given a chunk of code to help with accessing dynamic forum controls about a week back and when I implemented the code I get the error "Object reference not set to an instance of an object". I asked in the thread the code was given but have not recived an answer yet (asked about 4 days ago) and I think that is beause  the thread is marked as resolved. The line of code  causing the error is   if(t.Equals(this.ddlAmountToAdd.ClientID)&&!string.IsNullOrEmpty(v))    And here is the full code for the c# .Net 4 page.using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class GameInformation_AddUpcomingRelease : System.Web.UI.Page { public string[] Regions = { "USA", "Japan", "Europe", "Other" }; //Create a string array of regions. public string[] Platforms = { "PlayStation 3", "X-Box 360", "Wii", "Computer", "PSP", "Other" }; //Create a string array of platforms. protected void Page_Load(object sender, EventArgs e) { ddlPlatform1.DataSource = Platforms; ddlPlatform1.DataBind(); ddlRegion1.DataSource = Regions; ddlRegion1.DataBind(); } protected override void OnInit(EventArgs e)

SSIS package is giving error when ran thru JOB...its running good when I execute in BI Studio or Exe

Friends I am getting weird issue...I built an SSIS package. In one variable I used express builder and built like this... RTRIM( (DT_STR, 2,1252)  (((DT_I4) ( (DT_WSTR, 3) (SUBSTRING( @[system::machineName] , 12, 16 ))) +1) /2)) when I run the package outside ie., with VStudio or execute utility it running absolutely with out any problem. But when I created a job just to execute that package in particular timings...the job is totally failing by throwing error....the error output is like the following: Started:  10:22:33 AM Error: 2010-02-27 10:23:06.23    Code: 0xC00470C2    Source: Rerun_MissingFiles    Description: Error code 0x80020005 occurred attempting to convert from data type DT_WSTR to data type DT_I4. Error: 2010-02-27 10:23:06.23    Code: 0xC00470C4    Source: Rerun_MissingFiles    Description: Casting expression "(SUBSTRING( @[system::machineName] , 12, 16 )))" from data type "DT_WSTR" to data type "DT_I4" failed with error code 0xC00470C2. End Error Can any one help me please? Thanks in advance.

Configure managed accounts - object reference not set to an instance of an object - error

I was working in central admin and activated the managed accounts password change for the farm account with the option to change the password now.  I got the email notification that the password was changed and it seems in the log files that it did update all the credentials that were used with the account.  Problem is now that when I hit the configure managed accounts link in central admin all I get is the error: Error Object reference not set to an instance of an object.  Troubleshoot issues with Microsoft SharePoint Foundation. Correlation ID: c6dc7a46-894f-4b85-8711-8af1e8ec7903 Date and Time: 8/23/2010 9:20:20 AM Added information from logs: 08/23/2010 10:41:33.24  w3wp.exe (0x0F2C)                        0x07FC SharePoint Foundation          Logging Correlation Data       xmnv Medium   Name=Request (GET:http://cmtcalcium:33333/_admin/ManagedAccounts.aspx) b9fae5a9-7405-407d-87fc-239dc0ff59d0 08/23/2010 10:41:33.24  w3wp.exe (0x0F2C)                        0x07FC SharePoint Foundation     &n

Insert statement giving me syntax error


Good evening,


I have a MS Access table with the "ModelID" column set as AutoNumber and primary key. The ModelID is set as Field Size --> Long Integer, New Values --> Increment, Format --> General Number, Indexed --> Yes (No Duplicates).

Here is the code i am trying to execute, and is giving me an exception -> insert into syntax error:

string strInsert = "INSERT INTO tbl_Models (fName, lName, Image, Answer1, Answer2, Answer3, Answer4, Answer5, Votes, ImageHead, Age, Program, StudentID, PhoneNumber, EMail) VALUES (@fName, @lName, @Image, @Answer1, @Answer2, @Answer3, @Answer4, @Answer5, @Votes, @ImageHead, @Age, @Program, @StudentID, @PhoneNumber, @EMail)";
        OleDbCommand cmdInsert = new OleDbCommand(strInsert, myCon);

        cmdInsert.Parameters.AddWithValue("@fName", txtFirstName.Text.ToString());
        cmdInsert.Parameters.AddWithValue("@lName", txtLastName.Text.ToString());
        cmdInsert.Parameters.AddWithValue("@Image", FileUploadBody.FileName.ToString() + sRandomBody);
        cmdInsert.Parameters.AddWithValue("@Answer1", txtWhyBeAModel.Text.ToString());
        cmdInsert.Parameters.AddWithValue("@Answer2", "");
        cmdInsert.Parameters.AddWithValue("@Answer3", "

SqlCommand error: "Object reference not set to an instance of an object."


 Hi all,

I am not sure what's wrong with this block of code:

  • protected void FillDataGridView(string timeStamp)   
  • {   
  •  string select = "exec Uds.Dashboard_GetJobs";   
  •  string connectionString = WebConfigurationManager.ConnectionStrings["UctConnectionString"].ConnectionString;            
  •  SqlDataSource sourceRealtimeLogging = new SqlDataSource(connectionString, select);   
  •  SqlCommand cmd = new SqlCommand();   
  •  cmd.CommandType = CommandType.StoredProcedure;   
  •  cmd.Parameters.Add(new SqlParameter("@date", SqlDbType.DateTime));   
  • SQL query giving Sytnax Error



     I have a query which I would like to execute however since im not a real specialist Im unable to find what is exactly wrong in it.

    If anyone of the experienced DBAs could give me some tipos would be appreciated

    (query is not mine - it has been created by someone else)


    ALTER PROCEDURE dbo.CH_SyncClientSummary 
      declare @UTCdiff int 
      set @UTCdiff = DateDiff(mi, GetDate(), GetUTCDate()) 
      declare @currentsite varchar(3) 
      select @currentsite = ThisSiteCode from SMSData 
      Insert into CH_ClientSummary(MachineID) 
      Select MachineID 
      From MachineIdGroupXRef

    New installation of SQL Server 2008R2 -Giving time out error


    Hi all

    I did side by side installation of SQL Server 2008 R2 RTM with no CU and I given a Alies name to the installation,until now applications working fine.Yester day SAN storage devices(iSCSI) are upgraded with new software.

    after that I am getting an error

    "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. (Microsoft SQL Server, Error: -2)"

    action required I found in Microsoft site is "Make sure that you have configured the firewall on the server instance of SQL Server to accept connections"

    realy I don't know where I have configure this setting Please some help regarding

    Thanks in Advance


    Stored procedure giving strange error


    I have as stored procedure which executes a dynamic SQL  at the end. The dynamic SQL inserts into a temporary table declared at the begining of the procedure. When i execute the proc, it executes for a while and then gives me a truncation error.

    When i test the code witht out the proc, it works fine and come back with the result set. I am not able to figure out what culd be the issue.

    Kindly assist me in this..I have tried setting all colum lenghts to very high values then required but still it does not work when i execute the proc.

    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