|
Do you mean that the text was wrapping?
|
|
|
|
|
I think so, I had made the box wide enough for the longest reading and tried to trim out all non-essential character,but it looks like that was the problem. Ah well testing time today!
Glenn
|
|
|
|
|
Well, that's cured that problem WordWrap to False.
|
|
|
|
|
I need to create a routine that reads all the excel files saved from sql DB.
If I have 40 excel files in my DB. I need to extract all one at a time then read the content of the excel file, save it to a grid for reporting.
Excel is in standard template with only 4 columns.
Hope you could enlighten this.
Regards
Dabuskol
Dabsukol
|
|
|
|
|
dabuskol wrote: Hope you could enlighten this.
Open the Excel-file (using ADO.NET, or any other library), read the content in a loop, write it to a database. Grids aren't a storage-point, they're used for displaying.
What exactly do you need enlightenment with? How to read Excel, how to save it, or the complete task?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
excel files are saved in a database for every record created.
What I need is to read this files of every record let say 10 records per run then automatically read the content of each file to a grid for display purposes.
In the end all the contect of 10 excel files is displayed in the grid for viewing.
no human intervention, automatic with a single button.
Regards
Dabsukol
|
|
|
|
|
dabuskol wrote: What I need
Who is saving the Excel files, what database? Sql Server? Oracle? Sqlite? Are they saved as a BLOB, or is it a real import? Do you want to "show" 10 excel-files (and their content) in a single grid? How?
You'll have to formulate your question with a bit more detail to get a decent answer. And that's what we do, answer questions - that's a bit different from "providing codez". Like your question is standing now, I'm very inclined to explain how to add a button to the form.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
In a C# 2010 desktop/console appplication, I would to know how to accomplish my tasks (or at least part of my taks) listed below working with xml:
1. I want to parse out specific nodes so that I can access the various level of nodes I am working with.
2. I would like to place various data elements in a collection/array that I can work with like an array.
3. I would like to take the xml file and add certain sections to a sql server 2008 r2 database.
**Note: The xml contains the various kind of stuctures:
a. There is an occurence of 0 to 50 customer names.
b. There is a node is just unique elements.
c. There is an occurences of 0 to 25 elements that contain the
following 4 items in each occurence:
customer number, customber address, customer city state and zip,
contact name, contact number.
Thus can you tell me and/or point to to references that will show me how to accomplish my goals (or at least part of the goals)? If I have at least an example or two to look at, I can figure out how to accomplish the rest of the goals.
|
|
|
|
|
sc steinhayse wrote: 1. I want to parse out specific nodes so that I can access the various level of
nodes I am working with.
An easy way to do this is to use Linq for XML. Take a look at this[^].
sc steinhayse wrote: 2. I would like to place various data elements in a collection/array that I can
work with like an array.
Using XLinq this is trivial. Read up on it and see how you can use things like ToList() or ToArray() .
|
|
|
|
|
Can you show mne more code examples than the link you pointed to?
|
|
|
|
|
Sure. You can find examples of querying XML here[^]. If you were to post a simplified sample of the data structure you are talking about, I could show you a sample query or two that would mean more in the context of what you're trying to do.
|
|
|
|
|
I have a process to print my sql database Id in zebra printing machine with Barcode using c# i am confused i dint use zebra printing machine before . Help
BigHeart
|
|
|
|
|
Unsurprisingly, I was able to find a C# implementation of printing to this device with a simple Google search. Here's[^] one result. In future, you should really try to search Google before posting here because you are going to wait for an answer here.
|
|
|
|
|
I am writing a C# 2010 application where I am obtaining a response from a web service and placing the data into a string called XmlizedString listed below.
private string serializeXML(object objToSerialize)
{
String XmlizedString = null;
MemoryStream mStream = new MemoryStream();
XmlSerializer xs = new XmlSerializer(objToSerialize.GetType());
XmlTextWriter xmlTextWriter = new XmlTextWriter(mStream, Encoding.UTF8);
xs.Serialize(xmlTextWriter, objToSerialize);
mStream = (MemoryStream)xmlTextWriter.BaseStream;
XmlizedString = U8ByteArrayToString(mStream.ToArray());
private String U8ByteArrayToString(Byte[] characters)
{
UTF8Encoding encoding = new UTF8Encoding();
String conString = encoding.GetString(characters);
return (conString);
}
My next step is to place what I have in the field called XmlizedString
into one or two sql server 2008 database tables.
Thus my question is how would you parse out the data that is in the
XmlizedString? Would you save the data to a text file?
Basically can you tell me how you would take the XmlizedString data and
get the parts I need for the database? I do not want to keep calling the
web service.
|
|
|
|
|
Maybe load it into an XmlDocument, pull out the parts you want, and store them? Maybe?
|
|
|
|
|
Either load it into an XDocument for Linq transformations, or an XmlDocument for traditional manipulation. You can do either from a MemoryStream so you don't have to use the file system.
|
|
|
|
|
Can you show me some code examples?
|
|
|
|
|
I don't have any to hand, no. Searching should turn something up, however.
|
|
|
|
|
Normally when you talk to web services you get something called a "proxy dll". A sort of wrapper that represents the objects in the web service and can be used as a normal reference. Is the webservice returning a (string) field containing XML or are you talking about the response itself?
V.
|
|
|
|
|
I am talking about the repsonse itself.
|
|
|
|
|
dcof wrote: into one or two sql server 2008 database tables.
That is inprecise.
If you want to store the xml into a column in a table, then you just do that.
If you want to parse the xml, then transform it, then save data from that into columns then that is what you need to do.
If you don't need to tranform it then SQL server can parse and insert xml directly.
|
|
|
|
|
I would like to parse an xml file using linq in a C#2010 application. Listed below you will find an example of an xml file I want to parse. I would like to use the code listed below to parse the an xml file. Thus I am wondering if you can show me how to use the code I listed below to parse the xml displayed below and/or show me code that will accomplish this goal?
The following is the code:
using System;
using System.Linq;
using System.Xml.Linq;
class Program
{
static void Main()
{
XDocument document = XDocument.Load(@"d:\test.xml");
var priceInfo = from e in document.Descendants("MPrice").Elements("Price")
let start = DateTime.Parse(e.Descendants("StartDt").FirstOrDefault().Value)
let end = DateTime.Parse(e.Descendants("EndDt").FirstOrDefault().Value)
where start < DateTime.Now && end > DateTime.Now
select new { Id = e.Parent.Element("Id").Value, ListPrice = e.Element("ListPrice").Value };
Console.WriteLine(priceInfo.FirstOrDefault().Id);
Console.WriteLine(priceInfo.FirstOrDefault().ListPrice);
}
}
The following is the metatag:
<ns2:RetsubPack serviceSuccessful="true" returnCode="0" xmlns:ns2="http://test1/test">
<statusDescription>Package Details retrieved Successfully</statusDescription>
<PackageDetails>
<Type>type2</Type>
<Category>dog</Category>
<ContName>Co 1</ContgName>
<TotalTrans>0</TotalTrans>
</PackageDetails>
<NumberOfDocuments>3</NumberOfDocuments>
<subDocuments attachmentId="xx1">
<DocumentMetadata>
<DocumentTypeCode>Spreadsheet1</DocumentTypeCode>
<PackageId>pkg1</PackageId>
</DocumentMetadata>
</subDocuments>
<subDocuments attachmentId="xx2">
<DocumentMetadata>
<DocumentTypeCode>Spreadsheet2</DocumentTypeCode>
<PackageId>pkg1</PackageId>
</DocumentMetadata>
</subDocuments>
<subDocuments attachmentId="xx3">
</ns2:RetsubPack>
|
|
|
|
|
I don't use Linq, so I can't help you there, but I do manipulate XML a bit, usually in an XmlDocument, so maybe I can with that?
|
|
|
|
|
LINQ, it has been a while, but if I see you're query and the XML file, the code does not resemble the XML file? (or am I missing something?)
Some questions:
1. What do you mean with "parse" exactly, what do you want to achieve?
2. Do you know LINQ to XML?
3. Am I right that the code does not relate to the XML and if so, what is the exact problem? What have you tried yourself?
V.
|
|
|
|
|