|
hi dudes,
i want to copy a table from an access database to another table on another access database in windows application using c#,what is the best solution,i dont want my application to hang while copying the data;i've tried reading record by record by a simple oledbcommand execute way,but it would take a long time,i have a lot of records in source database,how can i do the copy by using dataset?is using dataset the best solution? how? how can i relate a progress bar to that? i've seen a class named sqlbulk which works for sql databases that copies a large amount of data between tables or databases,but my database is access.i will be thankful for those who do me a favor and give me an answer.
|
|
|
|
|
Don't use DataSet. Work with a reader and iterate all the rows and insert into target database. Do this in a separate thread, so that your application won't hang.
Best wishes,
Navaneeth
|
|
|
|
|
Just to add to this, use a progress bar as well, so that the user can tell the app is still working. (Always use a progress bar if the app is going to do anything that takes over two seconds is a good general rule).
Nothing will speed the process up noticably, particularly if the two databases are on separate machines.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
thank u both of my friends for ur answer,both of the answered gave me a pointer,but how can i relate copying data to a progress bar?
|
|
|
|
|
I need some help with a project im making it is pretty much a file archive system. It has the files in a single text file the file data is enclosed inside a head and a foot to identify it. which looks like this:
##:START:(FILENAME):(FILEDESTINATION):(FILESIZE):##
<CONTENT OF FILE HERE>
##:END--:(FILENAME):(FILEDESTINATION):(FILESIZE):##
the unpacker looks through the files and reads that data between the head and the foot and writes it into the destination directory it works for plain text files fine but when it comes to Executables the extracted file doesnt run and it has no icon anymore. Im using Encoding.Default to read and write all the data. Is there something im missing i think its possibly that the Encoding isn't quite right. When i open the exe in notepad and click save as it says its ANSI but that doesnt exist as a encoding type in Encoding.* would this be the problem?
|
|
|
|
|
fuze wrote: Im using Encoding.Default to read and write all the data.
Then you're not using the proper file methods to reading and writing binary data. You're treating everything as a text file, even the executables. You should be using the Binary Reader/Writer.
|
|
|
|
|
hi
i have wcf service host
and i keep all my clients callback in a list
is it possible to send this call back to one client so he will use the other client callback function
|
|
|
|
|
I want to know a serious problem: in my searches about storing data I find that I can store it in : XML Schema, or databases: SQLite, or any other db etc.
I want to store some int 's into a XMLS to be able to use them after I restarted the app.
My actual problem is: It is possible to store inside the actual app?
I don't want to store outside that app,in some sort of file.
thx.
OR a better question: How to store some data INSIDE running app, and then after restarting that app, the data remain there and be accessible ?
|
|
|
|
|
No, a running app cannot modify its code files (EXE, DLL); they are all locked as long as the app runs, so you can't rename, delete, or modify them.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
True on the surface, but using shadow copies of the assemblies does allow them to be modified while running. AppDomain and Shadow Copy[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You can use the app.config file to store values or the settings file[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
or any other file for that matter.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
yeee I find it and it does a great job indeed.
ha. I must now find a way to integrate an array there.
Here is How To Save Inside Your App !
1. select a button in the designer, open Properties for it, and see the first property named "ApplicationSettings". Click on the + sign to open his sub-properties. At the "text" property click the down arrow and it appear a little box-window. There inside click on the "(New...)".
2. At this stage, you should see a window named "New Application Setting". Change the name to "mySetting", Scope = User, Default Value = "aha". Click Ok.
3. (optional) To verify if all is how you want to be, open Solution Explorer - Properties-Settings.settings. A new window appear and open the Settings tab from the left. You will see there all your custom settings.
A little advice: select the button in the designer, go to it's properties again, and at it's Name property verify if it has the "aha" value there. It must be there, because you set it in the Default Value, last time.
4. In the code for that button, write this:
private void buttonSave_Click(object sender, EventArgs e)
{
if (buttonRestore.Text == "aha" )
{
buttonRestore.Text = "-!aha!-";
}
else
{
buttonRestore.Text = "aha";
}
Properties.Settings.Default.Save();
}
5. Run your app, click the button to change it's appearance, and restart app.
VOILA!
|
|
|
|
|
I think I find a BUG for this "ApplicationSettings".
It's about after I compile the program.
If I move the myprogram.exe on another folder or partition, the values that I originally stored, they disappear.
It only retain the information data if is Not moved.
WHERE THAT DATA GO, AFTER ALL?
Is inside it, really?
Or is somewhere stored in some temp file?
thanks.
|
|
|
|
|
If you look at the documentation for "Properties.Settings.Default" you will find it is saved in a file called "<yourappname>.exe.config" in the same directory as the application executable (i.e. ".../bin/debug" or ".../bin/release") If you copy this file when you copy your executable, you will be fine. The only other option is to store it in the registry, but this is not recommended:
1) Registry use is being discouraged, as it make it too big and cumbersome.
2) It is difficult to move your settings from one machine to another.
3) It is impossible to transparently have different settings for debug and release versions of your software.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
I am using Visual Studio Express Edition 2008 and want to use a timer from "System.Timers".
I don't know how to create the Event without any 'Tick'-Event when the timer interval elapses.
There is no 'Tick' event in the timers-pull down menu as described in different manuals and forums.
There is one example on
C-SharpCorner
timer1.Interval = 5000;
timer1.Enabled = true;
timer1.Tick += new System.EventHandler (OnTimerEvent);
So how can I create a method, that's been processed when the interval elapsed ?
|
|
|
|
|
There are several Timer classes in .NET and each of them has a different set of properties and events.
That article is about System.Windows.Forms.Timer, which are very good for supporting periodic GUI updates, such as a clock display.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Yes, in the meantime I found something about the different timers.
Since I don't use Windows.Forms, but XNA, I guess I rather should use System.Threading-timer, right ?
Is there any example for those timers ?
|
|
|
|
|
yes
yes
Google!
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
OK, thanks !
Good night.
|
|
|
|
|
The System.Timers.Timer class has an Elapsed event instead of a Tick event.
timer1.Elapsed += new System.Timers.ElapsedEventHandler(Timer1_Elapsed);
void Timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
}
|
|
|
|
|
OK, in principle that works. Thanks !
Now I have to work on the threading problem I got within my application...
|
|
|
|
|
I'm developing a chat server and a chat client in C#.
My client application is a GUI with some TabControls, ListBoxes, Buttons, Textboxes and Labels. The client also has a separate thread to detect messages sent from the server.
One of the messages sent from the server is to display what other users are available to chat with.
I can receive the other users IP-address and store them in a collection. When this is done I send an event from the thread method to the Client's GUI's Form-class and run a method to display the users.
That method is just clearing all items in a ListBox and insert all IP-addresses into the ListBox by foreach-looping the collection sent as a parameter from the event.
When I try this an: InvalidOperationException is thrown. The exception messages basically says this (translated from Swedish):
"The actions between threads are not valid. The control lstOtherUsers (the name of the ListBox) are received from an other thread that it was created in"
I can understand the problem why I cannot update the Item collection in my ListBox from an other thread when the ListBox was created in an other thread. But how shall I solve this?
|
|
|
|
|
What your experiencing is called Invalid cross-thread operations.
You can read more about it here
|
|
|
|
|