Click here to Skip to main content
15,892,005 members
Home / Discussions / C#
   

C#

 
AnswerRe: create an email application for own website Pin
Pete O'Hanlon24-Feb-11 23:50
mvePete O'Hanlon24-Feb-11 23:50 
AnswerRe: create an email application for own website Pin
Dalek Dave25-Feb-11 0:00
professionalDalek Dave25-Feb-11 0:00 
GeneralRe: create an email application for own website Pin
Pravin Patil, Mumbai25-Feb-11 3:15
Pravin Patil, Mumbai25-Feb-11 3:15 
GeneralRe: create an email application for own website Pin
Dalek Dave25-Feb-11 5:58
professionalDalek Dave25-Feb-11 5:58 
GeneralRe: create an email application for own website Pin
Ali Al Omairi(Abu AlHassan)25-Feb-11 8:53
professionalAli Al Omairi(Abu AlHassan)25-Feb-11 8:53 
AnswerRe: create an email application for own website Pin
Abhinav S25-Feb-11 3:21
Abhinav S25-Feb-11 3:21 
AnswerRe: create an email application for own website Pin
RaviRanjanKr28-Feb-11 2:34
professionalRaviRanjanKr28-Feb-11 2:34 
QuestionObject reference not set to an instance of an object. Pin
Pierre besquent24-Feb-11 21:55
Pierre besquent24-Feb-11 21:55 
Hi guys,
I have the above exception that appears to me when executing my code:
protected void Page_Load (object sender, EventArgs e)
        {
			 //Génération du fichier XML.
			if (this.Request ["ActionButton"] == "Generate")
			{
			   string					Json = "";
			  // Initiation de la collection
			  SLSalariesCollection		salaries = new SLSalariesCollection (this._Session);
			  salaries.Init ();
			  // Création du fichier xml.
			  string					fileName = @"D:\New Folder\MyXmlff.xml";
			   // Si le fichier existe effacer,
			  if (System.IO.File.Exists (fileName))
			  {
			    System.IO.File.Delete (fileName);
			  }	
			  XmlTextWriter	 myXmlTextWriter = new XmlTextWriter ("D:/New Folder/MyXmlff.xml",System.Text.Encoding.UTF8);
		          myXmlTextWriter.Formatting = Formatting.Indented;
			  myXmlTextWriter.WriteStartDocument(false);
			  myXmlTextWriter.WriteStartElement("root");
			  myXmlTextWriter.WriteAttributeString("xmlns","urn:iso:std:iso:20022:tech:xsd:pain.001.001.02"); 
			  myXmlTextWriter.WriteStartElement("pain.001.001.02");
			  int						j = 0;
			  // Récupérer la date d'Aujourd'huit de virement.
			  DateTime					Now = DateTime.UtcNow;
			  string					datevir = Now.ToString();
			  // Attribut Batch booking
			  Boolean					batch = true;
		      //formatter la collection de salariés.
		      foreach (SLSalarie salari in salaries)
		      {
		          j++;
		          Json = Json + "{succeed : 1}";
				  myXmlTextWriter.WriteStartElement("Salarié", salari.Matricule);
				 
		    }
			myXmlTextWriter.Flush();
                        myXmlTextWriter.WriteEndElement();
                        myXmlTextWriter.WriteEndElement();
			myXmlTextWriter.Close();
		    this.Response.ClearContent();
		    this.Response.Write(Json);
		    this.Response.End();
				
			}

the problem that the code is sometimes excuting very well,sometimes no and appear to me this fatal EXCEPTION.
I think that it is problem of refreshing my references.i did this.The first time, ok running very well,the second time EXCEPTION appears.
when doing breakpoints,the problem appears in the collection'initiation.How can I solve that?
also when reading about the class xmltextwriter,i know that i should treat that in my code c#.So do i should to add to my code to solve that?
Thank u very much for u help
hugs
AnswerRe: Object reference not set to an instance of an object. Pin
OriginalGriff24-Feb-11 22:32
mveOriginalGriff24-Feb-11 22:32 
GeneralRe: Object reference not set to an instance of an object. Pin
Pierre besquent24-Feb-11 22:39
Pierre besquent24-Feb-11 22:39 
GeneralRe: Object reference not set to an instance of an object. Pin
OriginalGriff24-Feb-11 22:44
mveOriginalGriff24-Feb-11 22:44 
GeneralRe: Object reference not set to an instance of an object. Pin
Pierre besquent24-Feb-11 22:51
Pierre besquent24-Feb-11 22:51 
GeneralRe: Object reference not set to an instance of an object. Pin
OriginalGriff24-Feb-11 22:58
mveOriginalGriff24-Feb-11 22:58 
AnswerRe: Object reference not set to an instance of an object. Pin
_Erik_24-Feb-11 22:36
_Erik_24-Feb-11 22:36 
GeneralRe: Object reference not set to an instance of an object. Pin
Pierre besquent24-Feb-11 22:50
Pierre besquent24-Feb-11 22:50 
GeneralRe: Object reference not set to an instance of an object. Pin
_Erik_24-Feb-11 22:59
_Erik_24-Feb-11 22:59 
AnswerRe: Object reference not set to an instance of an object. Pin
Abhinav S25-Feb-11 3:24
Abhinav S25-Feb-11 3:24 
AnswerRe: Object reference not set to an instance of an object. Pin
Eddy Vluggen25-Feb-11 10:20
professionalEddy Vluggen25-Feb-11 10:20 
AnswerRe: Object reference not set to an instance of an object. Pin
PrimeCoder25-Feb-11 23:01
PrimeCoder25-Feb-11 23:01 
QuestionTracking some HTTP requests Pin
Anubhava Dimri24-Feb-11 20:25
Anubhava Dimri24-Feb-11 20:25 
AnswerRe: Tracking some HTTP requests Pin
Bernhard Hiller24-Feb-11 21:03
Bernhard Hiller24-Feb-11 21:03 
QuestionCreating A Demo Version in C# Pin
varun.g24-Feb-11 19:34
varun.g24-Feb-11 19:34 
AnswerRe: Creating A Demo Version in C# Pin
Groulien24-Feb-11 20:27
Groulien24-Feb-11 20:27 
AnswerRe: Creating A Demo Version in C# Pin
Pravin Patil, Mumbai25-Feb-11 0:01
Pravin Patil, Mumbai25-Feb-11 0:01 
AnswerRe: Creating A Demo Version in C# Pin
Espen Harlinn25-Feb-11 4:09
professionalEspen Harlinn25-Feb-11 4:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.