|
I agree with Colin. To be honest, you are better off with the couple of extra clock cycles for your try/catch/finally block than you would be if you application falls over in a heap because the time between testing the server connection to the time you open/use the connection, the network goes down/server unplugged from the network, etc.
Do you use the using statement in code? If so, you are using try/finally, e.g.
using (SqlConnection connection = new SqlConnection())
{
...
}
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have an XML with non-english characters in the property name. My XML is something like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<file>
<city name="New York">
<population>10,000,000</population>
</city>
</file>
Now, instead of "New York", I have "ניו יורק", which is NY in Hebrew. Unfortunately, I cannot change this, and the problem is that the code won't recognize it. The code:
XmlDocument doc = new XmlDocument();
doc.Load("C:\pop.xml");
XmlNode xml = doc.DocumentElement;
string pop = xml.SelectSingleNode("/file/city[@name='" + cityName + "']/pop").InnerText;
Where cityName is New York in Hebrew. I tried changing the NY in all places to English - and the code worked, so I guess it's the Hebrew that is doing the problem.
Any idea how I can resolve this?
Thanks,
Yoni
|
|
|
|
|
Fix the encoding attribute in the <?xml?> tag so it matches the actual encoding of the XML.
|
|
|
|
|
Thanks. For some reason, the ISO-8859-1 wasn't enough, so I changed it to ISO-8859-8.
Yoni
|
|
|
|
|
Use UTF-8 (default of XML). Everything but Unicode (the encodings UTF8, UTF16, or UTF32) is depricated and only supported to allow loading data from legacy programs.
|
|
|
|
|
hi all
i need an implementation of an association rule mining algorithm. (no matter which algorithm)
thanks
|
|
|
|
|
Will this help?
http://www.vldb.org/conf/1995/P432.PDF[^]
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Don't post on multiple boards.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I’m struggling with a thread that should update a TreeView. I’ve started to use the Control.Invoke method when for e.g. adding nodes and so on.
I now wonder how I “Invoke” a property.
(I got the “Cross-thread exeption…” when I try to set the TreeView.ImageIndex property)
_____________________________
...and justice for all
APe
|
|
|
|
|
Either make an accessor method for the property or use the propertyinfo's get's methodinfo to construct a delegate to pass to Control.Invoke
|
|
|
|
|
Do you have any sample code on how to do that?
_____________________________
...and justice for all
APe
|
|
|
|
|
delegate void dAddListItem(string cItem);
private void StartThreadHere()
{
string cListItem="Item2";
if (this.listView1.InvokeRequired)
{
dAddListItem delAddItem = new dAddListItem(AddListItem);
this.listView1.Invoke(delAddItem, cListItem);
}
else
{
this.listView1.Items.Add(cListItem);
}
}
private void AddListItem(string cItemToAdd)
{
this.listView1.Items.Add(cItemToAdd);
}
private void Form1_Load(object sender, EventArgs e)
{
this.listView1.Items.Add("Item1");
Thread t = new Thread(new ThreadStart(StartThreadHere));
t.Start();
}
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi all,
I am not too sure where to post my question, so I'll just put it here and hope that somebody will help me. Honestly, I've reached a deadend after searching ALOT. I'll greatly appreciate any help or indication.
The problem:
In Internet Explorer you can right-click on a page and hit "Export to Microsoft Excel". This command is set in the registry (HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Export to Microsoft Excel) to call Excel with "EXCEL.EXE/3000".
The purpose:
I would like to develop a executable with simular functionality: the ability to be called from the internet explorer.
The question:
What is the technology that excel is using? Is it a COM object implementing an interface? How do I do that in .NET? And what on earth is that "/3000" parameter?!?
I've been looking for an answer for quite some time now. Please help.
Rgds,
G.
|
|
|
|
|
Due to the limitation placed on scripting languages due to security I do not believe that would be possible unless you wrapped the IE Browser in your own code, created an ActiveX control, or processed on the server.
Just my thoughts
|
|
|
|
|
Hi Christopher,
Thank you for sharing your thoughts. The main thing that really puzzles me is how it's possible to have a standard executable like Excel.exe being called from IE and work just like a script.
I'll follow your lead and take a closer look into ActiveX control, since I am not very familiar with those and perhaps there is something there.
Rgds,
D.
|
|
|
|
|
Hi again,
I managed to solve this on my own . If anyone is interested in the solution drop me a note on my mailbox..
G.
|
|
|
|
|
connstr = "data source =tm8425\gaurav ;initial catalog=gmcrm;user id=sa;password=maggy;";
sqlConnection conn = new SqlConnection(connstr);
error: unrecognised escape sequence. in tm8425\gaurav
Plz help
Thanks and Regards,
Ahmad
ahmad.osama1984@gmail.com
|
|
|
|
|
try using tm8425\\gaurav
"Change is the only constant thing in life
Either or survive or get extinct"
|
|
|
|
|
Can do like
connstr = @"data source =tm8425\gaurav ;initial catalog=gmcrm;user id=sa;password=maggy;";
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
yep!
"Change is the only constant thing in life
Either or survive or get extinct"
|
|
|
|
|
Hi all
how to display a dialog box on button click and accept the values given in the text box in the dialog box
sas
|
|
|
|
|
create a new form as a dialog and grab its text
"Change is the only constant thing in life
Either or survive or get extinct"
|
|
|
|
|
This is not enough i know how to do that but how to assign the textfron text box
|
|
|
|
|
send it back to main form through a public function or something like that
|
|
|
|
|
It goes something like this..
public class EditBox : System.Windows.Forms.Form
{
private Button isOK;
public TextBox aField;
... code here for the EditBox
}
public class MainApp
{
string TextfromUser;
private DoSomething()
{
EditBox eb = new EditBox();
if (eb.ShowDialog() == DialogResult.OK)
{
TextfromUser = eb.aField.Text;
}
... do something with text from the user
}
}
|
|
|
|