Click here to Skip to main content
15,899,754 members
Home / Discussions / C#
   

C#

 
AnswerRe: Communication between .NET 2 Assemblies and .NET 3.5 Assemblies Pin
PIEBALDconsult8-Dec-09 14:23
mvePIEBALDconsult8-Dec-09 14:23 
Questioninaccessible due to protection level Pin
Jassim Rahma8-Dec-09 2:17
Jassim Rahma8-Dec-09 2:17 
AnswerRe: inaccessible due to protection level Pin
Peter Vertes8-Dec-09 2:40
Peter Vertes8-Dec-09 2:40 
AnswerRe: inaccessible due to protection level Pin
Luc Pattyn8-Dec-09 2:51
sitebuilderLuc Pattyn8-Dec-09 2:51 
GeneralRe: inaccessible due to protection level Pin
Jassim Rahma8-Dec-09 4:54
Jassim Rahma8-Dec-09 4:54 
GeneralRe: inaccessible due to protection level Pin
Luc Pattyn8-Dec-09 5:02
sitebuilderLuc Pattyn8-Dec-09 5:02 
QuestionI try to bind an image file to pictureBox but my method dont work, how can I do this? Pin
behzad20008-Dec-09 2:16
behzad20008-Dec-09 2:16 
QuestionProblem in Reading Xml file [modified] Pin
<<Tash18>>7-Dec-09 21:57
<<Tash18>>7-Dec-09 21:57 
Hi guys,
Actually i have an xml file which is given below :

<ApplicationIndex>
  <Row>
    <ID>CCP</ID>
    <ApplicationDescription>Consolidated Liability Report</ApplicationDescription>
    <Category>CM</Category>
    <Business_Owner></Business_Owner>
    <CreatedID></CreatedID>
    <CreatedTimeStamp></CreatedTimeStamp>
    <Status>A</Status>
  </Row>
  <Row>
    <ID>CAPRC</ID>
    <ApplicationDescription>CAPRC</ApplicationDescription>
    <Category>CM</Category>
    <Business_Owner></Business_Owner>
    <CreatedID></CreatedID>
    <CreatedTimeStamp></CreatedTimeStamp>
    <Status>A</Status>
  </Row>
  <Row>
    <ID>ICC</ID>
    <ApplicationDescription>ICC</ApplicationDescription>
    <Category>CM</Category>
    <Business_Owner></Business_Owner>
    <CreatedID></CreatedID>
    <CreatedTimeStamp></CreatedTimeStamp>
    <Status>A</Status>
  </Row>
</ApplicationIndex>


Now i hav created a console application which reads this file the coding is as follows :

using System;
using System.Data;
using System.Data.Odbc;
using System.Xml;
using System.Configuration;
using System.IO;

namespace ConsoleApplication1
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class Class1
	{
		
		
		public void perform()
		{
			
			OdbcConnection con= new OdbcConnection();
			ADIBCrypto.Encryption64 crpto = new ADIBCrypto.Encryption64();
			try
			{

				string connString = crpto.GetCnnStr(ConfigurationSettings.AppSettings["appname"],ConfigurationSettings.AppSettings["dsnSybase"]);
				con.ConnectionString = connString;
				con.Open();
				Console.WriteLine("Connection Opened Successfully");
				XmlDataDocument doc = new XmlDataDocument();
				doc.Load(ConfigurationSettings.AppSettings["dest"]);
				XmlNodeList nodes = doc.GetElementsByTagName("Row");
				foreach(XmlNode node in nodes)
				{ 
					if(node.HasChildNodes && node.ChildNodes.Count > 0)
					{
						string ID = node.ChildNodes[0].Value;
						string ApplicationDescription = node.ChildNodes[1].Value;
						string Category = node.ChildNodes[2].Value;
						string Business_Owner = node.ChildNodes[3].Value;
						string CreatedID = node.ChildNodes[4].Value;
						string CreatedTimeStamp = node.ChildNodes[5].Value;
						string Status = node.ChildNodes[6].Value;
						Console.WriteLine("{0}",ApplicationDescription);  
											}
				}
				con.Close();
				Console.WriteLine("Connection Closed");
				Console.ReadLine();
			}
		
			catch(Exception ex)
			{
				Console.WriteLine(ex.Message);
				Console.ReadLine();
			}
		}
		
		static void Main(string[] args)
		{
			Class1 cc = new Class1();
			cc.perform();
		}
	}
}



now on the output field i get only null values (a blank) but i checked dat it reads the xml file and also checked whether it
returns the name of the xml node everything is fine... the only
problem is that now it doesnt give me the value of the child node.. please do help me...
(my actual aim is to copy all these records into my db.. that is why i hav db connections in my coding... that i will deal
with if the current problem is solved)
Thanx in advance....

modified on Tuesday, December 8, 2009 4:03 AM

AnswerRe: Problem in Reading Xml file Pin
SeMartens7-Dec-09 22:03
SeMartens7-Dec-09 22:03 
GeneralRe: Problem in Reading Xml file Pin
<<Tash18>>7-Dec-09 22:08
<<Tash18>>7-Dec-09 22:08 
GeneralRe: Problem in Reading Xml file Pin
<<Tash18>>7-Dec-09 22:13
<<Tash18>>7-Dec-09 22:13 
GeneralRe: Problem in Reading Xml file Pin
SeMartens7-Dec-09 22:19
SeMartens7-Dec-09 22:19 
GeneralRe: Problem in Reading Xml file Pin
<<Tash18>>7-Dec-09 22:24
<<Tash18>>7-Dec-09 22:24 
GeneralRe: Problem in Reading Xml file Pin
PIEBALDconsult8-Dec-09 7:18
mvePIEBALDconsult8-Dec-09 7:18 
QuestionString To Expression Pin
Elizma7-Dec-09 21:35
Elizma7-Dec-09 21:35 
AnswerRe: String To Expression Pin
OriginalGriff7-Dec-09 22:01
mveOriginalGriff7-Dec-09 22:01 
GeneralRe: String To Expression Pin
Elizma7-Dec-09 22:09
Elizma7-Dec-09 22:09 
AnswerRe: String To Expression Pin
wenjinxu7-Dec-09 23:00
wenjinxu7-Dec-09 23:00 
AnswerRe: String To Expression Pin
PIEBALDconsult8-Dec-09 5:11
mvePIEBALDconsult8-Dec-09 5:11 
QuestionFind & Replace by using FileAccess.ReadWrite Pin
sonj7-Dec-09 20:06
sonj7-Dec-09 20:06 
AnswerMessage Closed Pin
7-Dec-09 20:27
stancrm7-Dec-09 20:27 
AnswerRe: Find & Replace by using FileAccess.ReadWrite Pin
sonj7-Dec-09 21:44
sonj7-Dec-09 21:44 
AnswerRe: Find & Replace by using FileAccess.ReadWrite Pin
PIEBALDconsult8-Dec-09 7:42
mvePIEBALDconsult8-Dec-09 7:42 
QuestionConnect to Database Pin
Nastaran_daneshnia7-Dec-09 20:03
Nastaran_daneshnia7-Dec-09 20:03 
AnswerMessage Closed Pin
7-Dec-09 20:16
stancrm7-Dec-09 20:16 

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.