|
I have all that in, but after taking a good look again I realized that I never opened the connection.
Thanks for the quick reply
He who laughs last is a bit on the slow side
|
|
|
|
|
hi
just check the connection once.. i think connection string is not proper
thank u
Suresh.R
|
|
|
|
|
That was the problem, I never opened the connection
He who laughs last is a bit on the slow side
|
|
|
|
|
i don't know how to implement the xmlDOM concept in c# application.please tel me the concept and codings.
nalini
|
|
|
|
|
using System.Xml
That's about it really. The DOM is implimented by the XmlDocument class.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Nalini try with this code. I hope this will help you.
<br />
using System;<br />
using System.Xml;<br />
<br />
namespace DomNodeList<br />
{<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
XmlDocument doc = new XmlDocument();<br />
doc.Load(@"D:\workjjf\scripts\xml\MajorKeys.xml");
XmlNodeList majorKeyList = doc.SelectNodes(@"/Root/MajorKey");<br />
foreach (XmlNode majorKeyNode in majorKeyList)<br />
{<br />
XmlElement majorElement = majorKeyNode as XmlElement;<br />
string majorAttValue = "<null>";<br />
if (majorElement != null)<br />
{<br />
string attValue = majorElement.GetAttribute("att");<br />
if (attValue != null)<br />
{<br />
majorAttValue = attValue;<br />
}<br />
}<br />
Console.WriteLine(majorAttValue);<br />
XmlNodeList minorKeyList = majorKeyNode.SelectNodes(@"MinorKey");<br />
foreach (XmlNode minorKeyNode in minorKeyList)<br />
{<br />
XmlElement minorElement = minorKeyNode as XmlElement;<br />
string minorAttValue = "<null>";<br />
if (minorElement != null)<br />
{<br />
string attValue2 = minorElement.GetAttribute("att");<br />
if (attValue2 != null)<br />
{<br />
minorAttValue = attValue2;<br />
}<br />
}<br />
Console.WriteLine("\t" + minorAttValue);<br />
XmlNodeList valueList = minorElement.SelectNodes("Value");<br />
foreach (XmlNode valueNode in valueList)<br />
{<br />
Console.WriteLine("\t\t" + valueNode.InnerText);<br />
}<br />
}<br />
}<br />
Console.ReadLine();<br />
}<br />
}<br />
}<br />
Regards,
Satips.
|
|
|
|
|
It's obviously not going to run, you haven't given him the Xml that it's trying to load.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi,
doc.Load(@"D:\workjjf\scripts\xml\MajorKeys.xml");
if the file doesn't exsist how to handle the error and how to create a root node to enter values..
pls help me
with regards
prasad
|
|
|
|
|
hai
i want to splir string and i want keep two parts of that string into 2 string variables
can u plz send me the code in c#
Suresh.R
|
|
|
|
|
Hello,
Use the Split method of the string class.
This will return a string[].
Try and ask again if you need more help.
All the best,
Martin
|
|
|
|
|
hi
string[] str=string.split('');
example:
string s="xxx yyy zzzz";
if u want to split string with whitespace then write this
string[] str=s.split(' ');
i hope this works fine
|
|
|
|
|
Hello shakeela!
The reason why I didn't gave an example in my answer, was the "send me the code in c#" statement in the question.
This is mostely a sign of a "Please do my homework for me, because I don't whant to lose time by thinking myself!" question!
All the best,
Martin
|
|
|
|
|
Hi!
I want to locate main menu control according to my requirement in the middle of the windows form.But i couldnot find location property for that control. I want to ask that can i change its position or it will always be placed at the top of the form.
Thanx
|
|
|
|
|
A menu is ALWAYS on the top of a form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am writing a program that downloads a database on remote laptops, When downloading the file I noticed that my program uses about 15 MB of memory and calls Windows Explorer and WE uses about 16 MB of memory, the database file is about 60MB. I was wondering if there is something i am missing to reduce the amount of memory I am using. the laptops that will be using this app are older laptops and I want this process not to interfere with another database app that is very memory intensive. and once the download is complete it does not release the memory to a reasonable level any ideas.
Thanks
Rob
FileStream fs = null; //' To access the local file;
WebRequest req;
//StreamReader sr;
try
{
// This sets up the Request instance
req = WebRequest.Create("http://www.domian.com/file.zip");
// Use a GET since no data is being sent to the web server
req.Method = "GET";
// This causes the round-trip
WebResponse rsp = req.GetResponse();
try
{
// Open the file to stream in the content
fs = new FileStream("file.zip", FileMode.Create);
// Copy the content from the response stream to the file.
CopyData(rsp.GetResponseStream(), fs);
}
|
|
|
|
|
How exactly are you copying the data from the response stream to the file stream?
Another thing to consider is that looking at memory usage in the Task Manager (which is what I assume you are doing) can often be misleading. The allocated memory listed for a .NET-based application often includes memory which has been collected (i.e. released) as far as the application goes, but which simply hasn't been given back to the system by the runtime. However, that memory can be given back if and when the runtime believes the system needs it.
If there are specific performance (memory or CPU) requirements for your application, then I would suggest using a profiler to help determine where the bottlenecks are in your application.
-Phil
|
|
|
|
|
Hello everyone,
I have a string which I would like to remove the SPACE in the string. For example, I would like to change "I would like to remove any space." into "Iwouldliketoremoveanyspace.".
Can anyone be kind enough to tell me how I can get this done?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
mystring = mystring.Replace(" ", "");
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
string TrimmedString = YourString.Trim();
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Doesn't that only remove the spaces at the beginning and end of the string?
He who laughs last is a bit on the slow side
|
|
|
|
|
True .. sorry, you can use Christian's suggestion replacing white spaces.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: you can use Christian's suggestion replacing white spaces.
No. That only removes spaces. White space includes characters like tab and line breaks.
---
single minded; short sighted; long gone;
|
|
|
|
|
Okay "black" spaces;P.. no seriously, you can remove tabs at least doing this:
string strTabs = "a\t\t\tb";
MessageBox.Show("Before: "+str);
MessageBox.Show("After: "+str.Replace("\t",@"<tab>"));
string strNewLines = "a\n\n\nb";
MessageBox.Show("Before: "+str);
MessageBox.Show("After: "+str.Replace("\n",@"<enter>"));
-- modified at 4:01 Tuesday 3rd April, 2007
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Get("HI-bhas,-"));
}
public string Get(string str)
{
StringBuilder builder = new StringBuilder();
for (int i = 0; i < str.Length; i++)
{
if (char.IsLetterOrDigit(str[i]))
{
builder.Append(str[i]);
}
}
return builder.ToString();
}
}
Suresh.R
|
|
|
|
|
That's really awful. Why would you rewrite a method that's already in the framework ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|