Click here to Skip to main content
15,893,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,
Basically what I need is a solution to the following problem. I have a folder with a group of excel files having 500-600 rows for each file .I need to read these excel files automatically one by one and dump the records to some tables in the database. Before inserting the records some conditions are checked .

What I have tried:

The form has two buttons start and stop and also a timer with an interval of 500. When the timer is removed the process is little bit faster .But the problem is that I can't stop the process in between with the stop button. Is there any other suitable way to process it faster.
Posted
Updated 20-Jul-17 22:45pm
v3

Not a solution to your question, but another problem you have.
Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens door to a vulnerability named "SQL injection", it is dangerous for your database and error prone.
A single quote in a name and your program crash. If a user input a name like "Brian O'Conner" can crash your app, it is an SQL injection vulnerability, and the crash is the least of the problems, a malicious user input and it is promoted to SQL commands with all credentials.
SQL injection - Wikipedia[^]
SQL Injection[^]
 
Share this answer
 
Comments
Member 12926744 21-Jul-17 2:58am    
Thank you very much for the information .Since I'm new to C# I don't know about it.
That's very,very bad code. Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.

When you have fixed that - though your whole app - use the Stopwatch class to work out what part(s) of the method are using te time, and focus your attention on those parts.
Without knowing that, we are as unable to help as we were the last time you asked this question!
 
Share this answer
 
Comments
Member 12926744 21-Jul-17 2:59am    
Thank you very much for the information .Since I'm new to C# I don't know about it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900