|
Hi,
I am having spanish characters as memorystream, when i give this stream to xmldocument.load - it gives me Invalid characters errro. How to solver this isssue.
Be simple and Be sample.
|
|
|
|
|
Which encoding do you use for the characters, and what encoding is specified in the xml header?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
check encoding and update it accordingly.
Cheers!!
Brij
|
|
|
|
|
Make sure the encoding is the same. You should probably use UTF-8
ASCII tables, HTML entities, types, string formats and more info for the serious coder at: www.codecharts.com
|
|
|
|
|
Ok, three people so far have suggested that it's the encoding that is the problem.
Anyone else why want to suggest that it's the encoding that is the problem before we close?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: Anyone else why want to suggest that it's the encoding that is the problem before we close?
Not me.
I'm thinking there's characters in the stream that are invalid for the encoding of the XML.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hai
I am developing an application in C#.NET to control processes in remote machine I successfully started a process in remote machine but it is not visible ,it is visible only in task manager.Please help to make it visible
Sree
|
|
|
|
|
|
hi evreyone
is it possible to use xml file as database ?
if yes, is someone has any sample code in C# that can do Insert,Update and Delete job's ?
thank's alot for any help
|
|
|
|
|
Yes you can. But it doesnt mean you should. Performance wise its even a worse idea.
To do insert/update/delete you will need to load the xml document, find the node that you want as parent (for insert) or the node you want to update/delete, perform the action you need to do and then save the document again.
Loading the document once and keeping it in memory will speed up the process if its small amounts of data, else you'll find yourself running out of memory soon.
Hope this helps.
|
|
|
|
|
thank's for the quick anser
by database is very very small and i think,
that it will be better to use xml insted access or sql server
can i get any sample ?
|
|
|
|
|
As Guffa has said, its easy to load the data in a datatable and then save it as xml. That will increase query performance. That will however increase your xml document size.
If you dont want to use that way, heres a really simplified example of an update to a xml file:
<?xml version="1.0"?>
<Employees>
<Employee>
<ID>1</ID>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
</Employee>
<Employee>
<ID>2</ID>
<FirstName>Peter</FirstName>
<LastName>Pan</LastName>
</Employee>
</Employees>
string xmlFilePath = @"C:\Employees.xml";
int EmployeeIdToUpdate = 2;
string NewEmployeeLastName = "Panne";
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(xmlFilePath);
System.Xml.XmlNode eNode = doc.SelectSingleNode("Employees");
for (int i = 0; i < eNode.ChildNodes.Count; i++)
{
System.Xml.XmlNode employeeNode = eNode.ChildNodes[i];
int ID = int.Parse(employeeNode.SelectSingleNode("ID").InnerText);
if (ID == EmployeeIdToUpdate)
{
//Perform action
employeeNode.SelectSingleNode("LastName").InnerText = NewEmployeeLastName;
}
}
doc.Save(xmlFilePath);
Hope this helps.
|
|
|
|
|
You can save and load a DataTable as xml. Load the DataTable, change the DataRow items, and then save it.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
good.....
can i get code sample ?
|
|
|
|
|
|
.NET has many XML manipulation classes available. Use any of them to load and save data to XML file. If you are looking for file system based database, consider SQL lite[^]
|
|
|
|
|
|
Just use a borderless form.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
OK... but how do i find out, WHERE the Window should have its location?
And... "close" the form... how works that? Because, if it's a DialogForm i can't close it by clicking somewhere else!
modified on Tuesday, October 14, 2008 8:38 AM
|
|
|
|
|
I am not getting right direction to add plugin for IE in C#.
In my project I added BHO .But I want to add it as a browser Extension.
If anyone knows how to do it.so help me out.
Will be very much thankfull to all....
email:bishu_473@yahoo.co.in
regards
bishwajeet
|
|
|
|
|
I have a problem when I want call funtion in gridview by using templatefield.
The scenario is like this :
I want to call function : % of Compliance = getComplaince(field1,field2) in gridview. For your information field1 and field2 to in this gridview was set visible=false.
For example field1 = 1, field2 =1
The code is like below :
Field 1 Field 2 Application Definition % of Compliance
1 1 SMP Sistem Maklumbalas getCompliance(1,1)
2 1 E-App E-Application getComplaince(2,1)
getCompliance Function
1 public string getCompliance(int applicationID, int serviceID)
2 {
3 serviceCalculation c = new serviceCalculation();
4 string itemAB = c.getItemAB(serviceID, applicationID, lblError);
5 string[] splitItem = itemAB.Split(',');
6 string comply = c.countCompliant(splitItem[0].ToString(), splitItem[1].ToString());
7 return comply + "%";
8 }
getItemAB Function
1 public string getItemAB(int service, int applicationID, Label lblError)
2 {
3 database d = new database("S15TeRS");
4 int valueA = 0;
5 int valueB = 0;
6 double percentage = 0.0;
7 int counter = 0;
8 string query = "SELECT ss.ValueA,ss.ValueB,ss.Percentage FROM StateService ss" +
9 " INNER JOIN papv2.dbo.tblState s ON s.stateID = ss.stateID" +
10 " WHERE" +
11 " ss.ApplicationID='" + applicationID + "' AND ss.Service ='" + service + "'" +
12 " UNION" +
13 " SELECT ks.ValueA, ks.ValueB, ks.Percentage FROM KawasanService ks" +
14 " INNER JOIN papv2.dbo.tblKawasan k ON k.kawasanID = ks.kawasanID" +
15 " WHERE ks.ApplicationID='"+ applicationID +"' AND ks.Service='"+ service +"'" +
16 " UNION" +
17 " SELECT cs.ValueA, cs.ValueB, cs.Percentage FROM CawanganService cs" +
18 " INNER JOIN papv2.dbo.tblCawangan c ON c.cawanganID = cs.cawanganID" +
19 " INNER JOIN papv2.dbo.tblKawasan k ON k.kawasanID = c.cawanganID" +
20 " WHERE cs.ApplicationID='"+ applicationID +"' AND cs.Service='"+ service +"'";
21
22 try
23 {
24 d.Query = query;
25 d.InitDataReader();
26 while (d.findMoreRows())
27 {
28 counter++;
29 valueA += Int32.Parse(d.returnRow("ValueA"));
30 valueB += Int32.Parse(d.returnRow("ValueB"));
31 percentage += double.Parse(d.returnRow("Percentage"));
32 }
33 return valueA + "," + valueB;
34 }
35 catch (Exception ex)
36 {
37 lblError.Text = ex.Message.ToString();
38 return "";
39 }
40 }
41
countComplaint Function
1 public string countCompliant(string x, string y)
2 {
3 if (!(x.Trim().Equals("")) && !(y.Trim().Equals("")))
4 {
5 double a = double.Parse(x);
6 double b = double.Parse(y);
7 double compliant = b / a * 100;
8 double roundComplaint = Math.Round(compliant, 2);
9 return roundComplaint.ToString();
10 }
11 else
12 return "";
13 }
|
|
|
|
|
Hi
I am trying to set two different background images to two different resolution monitors.
I know that i can use somthing like
<br />
const int SPI_SETDESKWALLPAPER = 20 ;<br />
const int SPIF_UPDATEINIFILE = 0x01;<br />
const int SPIF_SENDWININICHANGE = 0x02;<br />
<br />
[DllImport("user32.dll", CharSet=CharSet.Auto)]<br />
static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ;<br />
<br />
<br />
and so on to get and set the wallpaper for a single monitor, but i am not sure how to expand this to work with 2 or more monitors.
I have had a look at the Screens.AllScreens class, but that seems more about the resolution and so on.
Anyone have any thoughts on how to do this?
|
|
|
|
|
Does windows even support this ??
ASCII tables, HTML entities, types, string formats and more info for the serious coder at: www.codecharts.com
|
|
|
|
|
I think theres a program called ultramon that can do it, and my nvidia graphics driver software can assign a diffferent image to each monitor.
Im very sure its possible.
|
|
|
|
|
yeah. Makes sense that is is driver-dependent. I cant do it on my Matrox G550.
ASCII tables, HTML entities, types, string formats and more info for the serious coder at: www.codecharts.com
|
|
|
|