Click here to Skip to main content
15,895,462 members
Home / Discussions / C#
   

C#

 
AnswerRe: Who gets the priority to access when 2 users try to connect to? Pin
PIEBALDconsult7-Aug-11 5:46
mvePIEBALDconsult7-Aug-11 5:46 
AnswerRe: Who gets the priority to access when 2 users try to connect to? Pin
Not Active7-Aug-11 8:39
mentorNot Active7-Aug-11 8:39 
GeneralRe: Who gets the priority to access when 2 users try to connect to? Pin
PIEBALDconsult7-Aug-11 9:10
mvePIEBALDconsult7-Aug-11 9:10 
QuestionCopy data mysql/xml to access Pin
Oslancz6-Aug-11 22:06
Oslancz6-Aug-11 22:06 
AnswerRe: Copy data mysql/xml to access Pin
Mycroft Holmes6-Aug-11 22:52
professionalMycroft Holmes6-Aug-11 22:52 
AnswerRe: Copy data mysql/xml to access Pin
Abhinav S6-Aug-11 22:53
Abhinav S6-Aug-11 22:53 
QuestionRe: Copy data mysql/xml to access Pin
Keith Barrow7-Aug-11 1:39
professionalKeith Barrow7-Aug-11 1:39 
AnswerRe: Copy data mysql/xml to access Pin
PIEBALDconsult7-Aug-11 6:09
mvePIEBALDconsult7-Aug-11 6:09 
Oslancz wrote:
via xml


Probably needless.


In general, to copy data from one table to another (given that the two tables are identical):

0) Create a Connection to the source
1) Open the Connection
2) Use ExecuteScalar to get a count of records to copy, use it as the max value for the ProgressBar
3) Create a Command to select the data from the source
4) ExecuteReader

5) Create a Connection to the destination
6) Use the GetSchemaTable method of the DataReader to cobble up a parameterized insert Command for the destination
7) Open the Connection
8) Begin transaction

9) Read from the DataReader, jump to 14 if done
10) Set the parameter values
11) ExecuteNonQuery
12) Increment the ProgressBar value
13) Jump back to 9

14) Commit or rollback as necessary
15) Close the DataReader
16) Close the Connections


But you'll want to run it on a thread and then you'll need to avoid cross-thread problems.
I also recommend raising an event for each record copied, rather than hard-coding the use of a ProgressBar.
You can also decide how to handle duplicate records and referential integrity problems.


P.S. Furthermore, I would write it as a console application rather than a Windows application, but that's just me.


Questionsoftware for drawing my application forms design Pin
md_refay6-Aug-11 19:45
md_refay6-Aug-11 19:45 
AnswerRe: software for drawing my application forms design Pin
PIEBALDconsult6-Aug-11 20:20
mvePIEBALDconsult6-Aug-11 20:20 
GeneralRe: software for drawing my application forms design Pin
md_refay6-Aug-11 20:23
md_refay6-Aug-11 20:23 
GeneralRe: software for drawing my application forms design Pin
PIEBALDconsult6-Aug-11 20:24
mvePIEBALDconsult6-Aug-11 20:24 
GeneralRe: software for drawing my application forms design Pin
md_refay6-Aug-11 21:04
md_refay6-Aug-11 21:04 
GeneralRe: software for drawing my application forms design Pin
OriginalGriff6-Aug-11 21:40
mveOriginalGriff6-Aug-11 21:40 
GeneralRe: software for drawing my application forms design Pin
PIEBALDconsult7-Aug-11 5:44
mvePIEBALDconsult7-Aug-11 5:44 
AnswerRe: software for drawing my application forms design Pin
BillWoodruff6-Aug-11 23:09
professionalBillWoodruff6-Aug-11 23:09 
AnswerRe: software for drawing my application forms design Pin
Richard Andrew x647-Aug-11 9:43
professionalRichard Andrew x647-Aug-11 9:43 
AnswerRe: software for drawing my application forms design Pin
BobJanova7-Aug-11 22:32
BobJanova7-Aug-11 22:32 
Questionadd combobox to datagridview Pin
md_refay6-Aug-11 18:22
md_refay6-Aug-11 18:22 
AnswerRe: add combobox to datagridview Pin
Mohammed Rakib Uddin6-Aug-11 20:22
Mohammed Rakib Uddin6-Aug-11 20:22 
GeneralRe: add combobox to datagridview Pin
md_refay6-Aug-11 20:23
md_refay6-Aug-11 20:23 
GeneralRe: add combobox to datagridview Pin
Mohammed Rakib Uddin6-Aug-11 20:45
Mohammed Rakib Uddin6-Aug-11 20:45 
GeneralRe: add combobox to datagridview Pin
md_refay6-Aug-11 21:05
md_refay6-Aug-11 21:05 
GeneralRe: add combobox to datagridview Pin
Mohammed Rakib Uddin6-Aug-11 21:41
Mohammed Rakib Uddin6-Aug-11 21:41 
QuestionConnect Window Application to db from different places Pin
md_refay6-Aug-11 18:18
md_refay6-Aug-11 18:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.