Hi all,
I have two question,First:Is how will data export to excel in datagridview.Second:
Is how will data import to database in excel.
Thanks in advance.
how will data export to excel in datagridview
Ask by Kenny Tangnde
Updated 22 Aug 2013
Hi, here is an alternative and for me a more flexible and simplier way you can try to export DataGridView to Excel file in C#:
Also here is how you can import Excel file to a DataTable in C#:
I used this C# Excel component.
You can use following link to export data from excel to data-grid view,
http://support.microsoft.com/kb/321686
Thanks,
This is really good.
Can any one give me some example of datagridview demo in c#. So i can make a complete program on it.
Thanks,
Hi all,
thanks Awadhendra Tiwari,It helps me a lot.
Thanks.
You can take a look at following link for learning linq
http://msdn.microsoft.com/en-us/vcsharp/aa336766
http://geekswithblogs.net/elroydsilva/archive/2008/11/03/learning-linq---an-overview.aspx
http://www.linqlearning.com/sp/16295-LINQ-to-SQL-Tutorials-Learning-Resources/
Thanks.
hi Awadhendra Tiwari,Rohit Kesharwani,
Thank you for your help,Thanks Rohit Kesharwani . he helps me a lot.
again ask a question:
you can provide LINQ learning resources to me,and LINQ in project the integrated application.
Grateful.
using System.Data.SqlClient;
You can make following modification on above code
using System.Data.SqlClient; //import this namespace at top
then replace OleDbCommand by SqlCommand class.
Then above code also work for you.
Thanks.
hi Rohit Kesharwani,
i not used using System.Data.OleDb; i want used using System.Data.SqlClient;
Thank you always help me, I hereby express my sincere thank you.
hi,
If you want that only checked rows will be exported then simply manipulate the above code:
Thanks.
hi Rohit Kesharwani,
Here are the solution of your both the problem:
Export Data from Excel in dataGridView:
Write the below code on the button click or on form load function:
Import Data from dataGridView in Excel:
Happy Coding.