|
I want to create a XML document in the filesystem out of the XML that is coming from the table column. The column is of type Xml. So how will i do it. I understand that we can use the ADO classes when oing an updation into the column. How to get it into the code from the database table column?
Srivatsan
|
|
|
|
|
If your sql server is sql 2005 then there is an xml type in sql 2005 that you can use. If you are using sql 2000 then you have to convert your xml type in .net to a string and save it in a text column.
Hope that helps.
Ben
|
|
|
|
|
You start off by learning the C# syntax, then you get used to using the BCL (Base Class Libarys) and then you read up on the specifics of using ADO.Net.
You'll see that I gave a link to google with the appropriate keywords to help you find what you want.
If that's no good there are plenty of books out there on how to do this.
|
|
|
|
|
Hello. I have a big problem with network streams.
I have a network stream and, from time-to-time i have to check from messages received from the server.
My problem is that if i receive, for example, 2 messages from the server if I run in debug mode and stop just before the read, it reads both messages received. But if i run in release mode, i get only the first command(because there is a a small period of time between the two messages where stream.DataAvailable is set to false and it exits my loop).
How can I fix this problem? Because I don't know in advance how many messages the server will send.
This is my code:
<br />
if (stream.CanRead)<br />
{<br />
while (stream.DataAvailable)<br />
{<br />
numberOfBytesRead = stream.Read(myReadBuffer, 0, myReadBuffer.Length);<br />
myCompleteMessage = String.Concat(myCompleteMessage, Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead)); <br />
}<br />
} <br />
CAN SOMEONE PLEASE HELP ME???
IT'S A B IG PROBLEM FOR ME, I'M NEW IN C#
THANKS IN ADVANCE!!
|
|
|
|
|
I think you're better of building an Asynchronous Client Socket[^]
It involves a little more code, but it results in a more responsive application and it's easier to extend in the end.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
I have an assembly file..
How I can find out(in run time) the assembly is COM server or not
(It's not registered by regasm.)?
Thanks.
|
|
|
|
|
Hello everyone,
I am developing a windows application in which it contains a ListView. I am showing the contents(rows) of the ListView from a csv file where each row represents a different data. I wish to have the ability of deleting any selected row. It appears the only options that I am getting from Streaming is "streamWriter.WriteLine" and "streamReader.ReadLine".
My finding so far is that the only way to delete a row from a text-based file is to rewrite that file without the particular row you want removed. So, I should delete the file, loop through the remaining rows in the ListView, and write them back out one by one. This is not something which I wish to do and I was wondering if there is any better way to get this done?
Can anyone be kind enough to tell how I can get this done?
Thank you very much and have a great day.
Khoramdin
-- modified at 3:31 Tuesday 3rd April, 2007
|
|
|
|
|
Unfortunatly what you wan't isn't possible in a normal textfile or a CSV file for that matter.
The best option is to rewrite the whole file, depending on how large the file is.
It's generally not a good idea to use CSV files as the main data source for large quantities of data. Instead you can import the data in a database and keep it there. Then when you need a subset for export, you can always write something to export the data from the database to a CSV file.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
Helo Willem,
Thanx for the reply. My online search also led me to come to the same conclusion. The problem is that I am trying to make a Windows Application which requiers the least from the User system. In addition to that this data is going to be available locally even the user is not connected to internet. Therefore, the assumption is that the user has got no database facilities avaiable locally on thier computer and there is no remote database access.
fortunatly, the CSV file is not going to be very large (My estimation is 10Kbit maximum) which If I am not mistaken is not going to effect the respond of the Windows Application.
The only question that comes to my mind is that which way of the followinf I should use for this purpose?
1- Line by line (reading from one file and writing to another, modifying the data on the way).
2- In "bulk" (load everything into memory, modify the data structure, and write it out again).
Thank you very much for your help and have a great day.
Khoramdin
-- modified at 11:40 Tuesday 3rd April, 2007
|
|
|
|
|
Hi all, I am having problems with the following...
When I run the command dataAdapter.Fill(dataSet) i get the following error...
"Fill:SelectCommand.Connection property has not been initialized"
Any ideas why?
Thanks in advance
He who laughs last is a bit on the slow side
|
|
|
|
|
A DataAdapter as to be associated with a Connection, this can be done in several ways, for instance (excerpt from David Sceppa’s ADO.NET book)
string strConn = "Provider=SQLOLEDB;Data Source=(local)\\NetSDK;" +
"Initial Catalog=Northwind;Trusted_Connection=Yes;";
OleDbConnection cn = new OleDbConnection(strConn);
string strSQL = "SELECT CustomerID, CompanyName FROM Customers";
OleDbCommand cmd = new OleDbCommand(strSQL, cn);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
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 )
|
|
|
|