can you please help me with your updated program of uploading excel data into database using bulkcopy. Also, is it possible to dynamically prepare queries while reading the excel file based on the column headings.
after taking your excel in dataset . you can directly insert the data into the table .
using (SqlConnection connection =
//Open bulkcopy connection.
using (SqlBulkCopy bulkcopy = new SqlBulkCopy(connection))
//Set destination table name
//to table previously created.
bulkcopy.DestinationTableName = gettablename;
catch (Exception ex)
Label2.Text = "inserted succesfully";
hope this helps ... for dynamically prepare queries , i will have to work on that.. if i will do , i surely let you know .
if i am getting you right ... you want to take the excel .. and according to the columns .. you want to create scripts for insert and update .. using excel column and its datatypes as database table datatypes .wuhuuuuu seems lotsa work to do ... :P :P .. it can happen .. but its tough .. untill we don't know .. what is the data .. and how we want to save it in our database . because before saving excel column into database's table .. we have to match the datatypes of both .