|
wow... dunno why I assumed it didn't :p good call
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Hi there,
I am very new to C#.net, now I have problem to enhance my codes below so that program can upload all the *.txt from the folder to remote server. Right now my code below is only cater for 1 specific file name "text.txt". But I need your advice how can i use *.txt in c#.net. Appreciate for all the respond to my questions.
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (Request.Files.Count > 0)
{
Request.Files[0].SaveAs(@"C:\Inetpub\wwwroot\EDIHTTPS\test.txt");
}
else
{
|
|
|
|
|
Sorry...to continue the code...
else
{
httpUploadFile("http://localhost/EDIHTTPS/WebForm1.aspx", "c:\\test.txt");
}
}
|
|
|
|
|
Use Directory.GetFiles() method to get the paths of all the files in a folder.
After that you can use Path.GetFileName() to get the name of each file.
|
|
|
|
|
Thanks for your prompt respond.
But I am still kinda blur. Do you have sample coding?
Appreciate that.
|
|
|
|
|
Something like this might help:
string[] thePaths = Directory.GetFiles("c:\\My Folder");
<br />
foreach (string filePath in thePaths)<br />
{<br />
if (Path.GetExtension(filePath) == ".txt")<br />
{<br />
}<br />
}
Have a nice day!
|
|
|
|
|
Hello,
Just an info!
By using the second parameter (searchpattern) of the GetFile method like this:
string[] thePaths = System.IO.Directory.GetFiles("c:\\My Folder", "*.txt");
you don't need the loop!
If you have .Net framework >= 2.0, you also use a "SearchOption", for searching also in the SubDirectories.
All the best,
Martin
|
|
|
|
|
Hi,
How will i convert a XML datatype in SQL to a C# datatype. Can we use XMLDocument datatype in C#? If yes how can it be used?
Thanks in advance
Srivatsan
|
|
|
|
|
|
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 )
|
|
|
|