|
Hi, any idea how to calculate files size found in some folder??
string[] arSourceFiles = System.IO.Directory.GetFiles(MyDir);
arSourceFiles.(:confused:);
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Try This....
foreach (string file in arSourceFiles)
{
FileInfo finfo = new FileInfo(file);
int filesize = finfo.Length; // Length returns the size of file.
}
|
|
|
|
|
Looks good enough thank you Mandaar
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello,
If you also whant to look in the folders of you main folder, you have to go threw it recursive!
Like this:
private double GetFileSize(DirectoryInfo di, double currentsize)
{
double actsize = currentsize;
FileInfo[] AllFiles = di.GetFiles();
DirectoryInfo[] AllDirectories = di.GetDirectories();
foreach(FileInfo fi in AllFiles)
{
actsize = actsize + fi.Length;
}
foreach(DirectoryInfo dinew in AllDirectories)
{
actsize = GetFileSize(dinew, actsize);
}
return actsize;
}
I think there is some feature in .Net >1.1 which does that.
Hope it helps!
All the best,
Martin
|
|
|
|
|
|
|
Hi Friends,
I want to merge to dataset i.e ds1 into ds2 and commit changes in ds2.
I managed to merge but its not commiting changes
Any help Please?
|
|
|
|
|
Try this.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I guess I didn't explain my problem v.well.
Basicaly i have 2 data bases each datbase got 1 table with same schema.
first database table has got 20 rows while 2nd Database has got 5 records
I want to insert other 15 records from first database to 2nd database
I opened two connection connectino 1 and Connection with databaeses respectively and filled 2 DataSets ds1 and ds2 respectively.
I am merging datasets as
ds2.Merger(ds1);
its showing 20 records in ds2 also but its not updating those records in Databaset it showin in debugging mode only.
How can I update those to database. thanks.
|
|
|
|
|
Deer All,
I have created a windows application using C# .NET 2005 and I used Crystal Report Viewr to view three kinds of reports according to different criterias. The starange thing is that the application ran without errors for some days and after that the following error appear and I try to fix it by all things I thought about without any change.
The exception is:
" The type initializer for 'CrystalDecisions.ReportSource.ReportSourceFactory' threw an exception. "
Please, help me as I think later to use Reporting Server instead of Crystal Report but this will be waste for time whitch is the most invaluable thing.
Thanks alot for cutting your valuable time.
Dina A.H
Software Developer
|
|
|
|
|
I have two radiobuttons of same group and three buttons back, next and cancel in the same order. if i check any of the radiobuttons, back button is highlighting. i want Next button to be highlighted.i.e Focus should be on Next button.
Any solutions??
Imran.
|
|
|
|
|
Try setting focus mannually in the Click event or CheckedChanged event of the radio button using BtnNext.Focus()
|
|
|
|
|
Hi.
I want to insert a record in a table and then get it's ID(which is an autonumber field) to use it as a reference in another table. What is the best approach?
Thanks.
|
|
|
|
|
blackjack2150 wrote: I want to insert a record in a table and then get it's ID(which is an autonumber field) to use it as a reference in another table. What is the best approach?
What is the database?
|
|
|
|
|
If this is a MS-SQL database Ive gotten this to work by using a stored procedure and returning @@IDENTITY from the stored proc.
The only other way I know of is to timestamp the record at the time of writing and return the record with that timestamp(or some other form of identifying field) in a query statment.
|
|
|
|
|
Let's continue on the database forum.
This topic can now be deleted by the admin.
Thanks.
|
|
|
|
|
blackjack2150 wrote: This topic can now be deleted by the admin.
Why should he? The admin is busy enough with other things.
|
|
|
|
|
Dear All,
Please let meknow how can I encrypt a string and store the encrypted string in database, then reterive the encrypted string and decrypt it.
thanx
|
|
|
|
|
Depends on how strong the encryption must be.
The easiest and most fun way is XOR encryption. I'm sure you'll find plenty of information and examples on the web.
|
|
|
|
|
|
|
|
plz try this article:
http://www.codeproject.com/useritems/Encrypt_an_string.asp
> use RC2 algoritm
First and the Foremost: FIGHT TO WIN
About Me
|
|
|
|
|
I usually develop my own encryption methods, two methods to encode and decode using very basic ways, like getting the integer value of the string, play with it, store it. Do the opposite when retrieving it.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
The biggest problem with crypto is keeping the secret secure.
There are plenty of libraries available that will do Rijndael/AES. Including some stuff that ships with .Net
I've used the .net libraries a few times in the past, although if i could find a properly peer reviewed open source verison i'd be much happier using it.
XOR should only be used for the very lightest crypto requirements, it's very oldhat and can be easily broken.
I suppose it depends what you want to do. XOR will hide your girlfriend's phone numbers from your wife but it wouldn't hold up very long against the forces of the RIAA trying to prove that you once looked at a copy of that DVD key.
Russell
|
|
|
|