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


Top 5 Contributors of the Month
Sharon Maxwell
Post New Web Links

READING XML FILE

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :ASP.Net
 

Hi guys,

I have a XML FILE that follows the following structure:

<products>

    <product code="abc" description="abcdefghj" price="9,99">

    <product code="def" description="aklsjdalsd" price="7,50">

</products>


What can I do to get the information: CODE, DESCRIPTION, PRICE for each product information????

Thanks in advance

Clemilson




View Complete Post


More Related Resource Links

reading excel file problem

  

Hi,


i have 200 rows in my excel file. im using OleDbConnection to read the excel file.

The problem is that it will read all the blank rows from row 200 onwards. Is there a configuration im missing ? or is there a way to import all rows that has data? Here's some of my code.


string excelConnectionString =
               "Provider=Microsoft.Jet.OLEDB.4.0;" +
                "Data Source=" + filePath + ";" +
                "Extended Properties=Excel 8.0";

OleDbConnection excelConnection =
                    new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties='Excel 8.0;HDR=NO'");


OleDbCommand cmd = new OleDbCommand("Select * from [list$]",excelConnection);







Reading an excel file

  

Hi,

i am trying to read an excel file.

when i read the entire file, it works fine.

but when i try to read a single column, i get the following exception message:

"Could not find installable ISAM".

the code i am using is:

string  connString = "Provider=Microsoft.ACE.OLEDB.12.0;" +  

 

"Data Source="+ fileName + ";" +

 

"Extended Properties=Excel 12.0;HDR=Yes";

OleDbConnection oledbConn = new OleDbConnection(connString);

 

try

{

// Open connection

oledbConn.Open();

 

// Create OleDbCommand object and select data from worksheet Sheet1

OleDbCommand cmd = new OleDbCommand

reading some strange file

  
hi all,I have a file that i want to read created by a program from another company.I fi open the file in notepad it has all kind of funny chars in it, i tried different ways of reading it in vb.net but the funny chars stay.Anyone has any idea how to read something like this?this is an extract from the file  Z "f 2006/05/19 13:44:28 < ----------- uStreetname 91 1745 Opwijk                                                                                  ' 590208356329 SLIN3f )lÿ%g: )' 29.11.2005grtz & thnx to anyone who looked into this.bjorn

Problem when using Activator.CreateObject and reading App.Config file

  
Hello, this is the scenario. I have an application that load at runtime severals dll. these dll are actually "adapters" that wraps calls to web services, database and so on. The app.config of the "main" application stores in config sections all information necessary to each adapter (i.e.Web ServiceURL..) and I have created inside each adapter a class to ready those values the loading at run time the DLL has been implemented by storing all necessary types into a dictionary of generics and when I need to instanciate it I call the Activate.CreateObject and I pass the specific type (I means the name of the Adapter class) The problem is that the adapter class itself is not able to get the config value because ConfigSection has not been initialized. If I write: IInterfaceAdap adapt = new myAdapter() -> I read the config data IInterfaceAdap adapt = (IInterfaceAdap)Activator.CreateObject (type) -> now way to read the data stored in the App.Config. I think that I undertood the problem but I'm not able to find a workaround to read data store in the app.config!! I need help please!!  

reading excel file without saving to disk first

  
Having an issue.  I need to be able to read an excel file from a file upload control but I can not save the file to disk first, it must be done in memory.string excelConnectionstring = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="; excelConnectionstring += filePath.Replace("/", "\\"); excelConnectionstring += ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1;'"; OleDbConnection con = new OleDbConnection(excelConnectionstring); OleDbDataAdapter da = new OleDbDataAdapter();Above is my code for reading the data file if it IS saved to disk, but again, I have to be able to do this without saving the file to disk, it must be done in memory.  I have not been able to find any sample code anywhere on how to do this from memory, everything seems to force the file be uploaded, saved to disk, and then read in the connection string, which again I can not do.Any advise would be great, thanks in advance.  I'm really in a bind here.

Error reading .config file in Windows Forms app - Access is denied

  
I'm attempting to read a connection string from a .config file in a Windows Forms app on a test laptop. A previous version of the application worked just fine, but now I get a configuration exception thrown - "Configuration system failed to initialize." The inner exception message says - "An error occurred loading a configuration file: Access is denied". The user I'm logged in as is in the Administrators group and there's no obvious problems with the config file. The same config file works just fine on my dev machine so it's not an issue with ordering of the XML. Any ideas would be greatly appreciated.If a response to your question is helpful or answers it please mark it as such!

Error reading .config file in Windows Forms app - Access is denied

  
I'm attempting to read a connection string from a .config file in a Windows Forms app on a test laptop. A previous version of the application worked just fine, but now I get a configuration exception thrown - "Configuration system failed to initialize." The inner exception message says - "An error occurred loading a configuration file: Access is denied". The user I'm logged in as is in the Administrators group and there's no obvious problems with the config file. The same config file works just fine on my dev machine so it's not an issue with ordering of the XML. Any ideas would be greatly appreciated.If a response to your question is helpful or answers it please mark it as such!

Reading each record from a text file and sending email

  
Hi All, I have a text file (CSV) which has only three fields (Name, Email, SendYN). I want to read each record from this text file and send email to those records where SendYN field has Y. I had created Flat File connection and a Flat File source in a data flow which uses Flat file connection. Now I stuck how to move further. Which control I need to add and where to identify whether SenderYN = Y and how to send email? I am new to SSIS. Thanks.

Reading from Excel file : win form

  
Hi All, I have the following requirement  There are 10 Excel files in a folder.Each excel file contains only 1 column which contains severeal IDs listed. Now, I want to read those IDs in each & every excel file. How do I get the count of number of excel files present in that folder?? After getting the count, how do I read each Id present in that file?? Any help will be greatly apprecited.. Thanks, Alex

WCF Reading Endpoint Behaviors from a web.config file

  

Hi

I've got a WCF service which has multiple clients that it connects to.

What I want to do is to create the clients dynamically the WCF services consumes.

Creating the clients by inheriting from the `ServiceFactory<TChannel>` class is done and very simple. What I'm struggling with is how to read Endpoint behaviours from the `web.config` file and add them to the clients?

Code file

    BasicHttpBinding binding = new BasicHttpBinding(bindingConfigName);
    EndpointAddress endpoint = new EndpointAddress(endpointUrl);
    ChannelFactory<IShoppingSoap> clientEndpoint = new ChannelFactory<IShoppingSoap>(binding, endpoint);
   
    base.Endpoint.Behaviors.Add(*Get the behavior from the config file*);
    return base.CreateChannel();

`Web.config` file :

    <behaviors> 
        <endpointBehaviors> 
           <behavior name="EndpointBehaviour_GmCustom">
             <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
      

Reading in values in text file in a project solution to an array

  

Hi,

I have a tab delimited text file that has 6 columns (all integers) and 500 rows (and no column headings) called ProjectData.txt that I have added to my Windows Form Application (c#) (by added I mean I have it in my project solution). 

I have declared an array in my code called ProjectDataArray which has dimensions [500, 6].

I wish to load each column of each row into the array.

All the code I have seen shows how to do this for text files that are not included in the project solution. 

Is this easy to do?


reading text file using sql server 2000 , 2008

  

hi,

can any one tell me how to read the data's in the text file using sql server 2000 and 2008.

i have a text file in a server and it contains one column name with the multiple column values i need to read that informations and i need to update in a table in the database.

how can we do this.

Regards,

lawmen



Reading Binary file

  

Hi All, 

 I am using BinaryReader class to read binary file.But I am facing problem while reading number of  bytes from it.

I have written code to read only 2 bytes from it,it works well on my machine and read only 2 bytes,but when I deployed that code on server machine it read 4 bytes from file.Whats wrong in the code?Is it due to processor i.e.. 32 bit processor/64 bit processor I am using?

Please provide solution or any link for it ASAP..

Thanks in advance

Vaibhav

 

 


Reading strings from a binary file

  

I am tasked with reading various files that were saved to disk by a Visual Basic 4 application.

I've started with the easiest of the files, which contains one or more strings, each 128 bytes in length.

And so I wrote the following code to put these strings in a list:

 

Console.WriteLine("========== START ==========");

var list = new List<string>();

var fileStream = new FileStream("(Filename)", FileMode.Open);
	
var bytes = new byte[128];
while (true) {
 if (fileStream.Read(bytes, 0, bytes.Length) == 0) break;
 list.Add(System.Text.Encoding.ASCII.GetString(bytes));
}

foreach (var s in list) Console.WriteLine(s);

fileStream.Close();

Console.WriteLine("========== END ==========")

Reading and checking .CSV File and Inserting Data to SQL server

  

Hi,

I have got a page in which there is a file upload option where I have to upload/import the csv file. What I want to do is to check if the correct format of file is uploaded for instance if any other than csv file is uploaded, the system should give an error message. Also what I need to do is to check certain fields of the csv file for instance there are some mandatory fields in the csv file which should be there like name , postcode, How can I check that these fields are not empty . After performing these task, the system should automatically upload the csv file onto the sql sever 2008. Any ideas  or tutorial ... will be highly appreciated. 


SQL Server 2008 r2 - Setup support files - Install error / reading from file

  

I'm installing SQL server 2008 r2 on a Win2003 R2 x86 system.

After i start the setup, the "setup support files" box begins installing, after a while i get this error:

"Error reading from file f:\1033_ENU_LP\x86\setup\sqlsupport_msi\PFiles\SqlServr\100\Setup\ewbfphdh\x86\Patch\rs2000.msp verify that the file exists and that you can access it."

I've tried another DVD, i've tried a mounted share on another machine...no go....i've tried an ISO file mounted on this server... same error.

Is there any way i can install this "setup support files" from another location? (download)

Is there a switch soo it won't install reporting services? (...i think this file rs2000.msp is from reporting services)

Thanks

Pipas

 

 


Reading Data From File Gets Corrupted

  

I am reading data from a TXT file that requires me to replace some of the existing data, and then write it back to the file.  The issue is, there are special characters in the file that get corrupted when I write the text back to the file.

For example, I have a string in a file "foo.txt" that has the following "?rdrf  +À [HIGH]".  My application reads the text into a string, goes through the line and replaces [HIGH] with a value, and then writes back to the file.  The issue is, the special text characters get corrupted.

Here is an abbreviated version of the code base:

string fileText = System.IO.File.ReadAllText("foo.txt");
fileText= iPhoneReferenceText.Replace("[HIGH]", low);
TextWriter tw = new StreamWriter

Categories: 
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