Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a little problem with not exactly importing excel file to dgv, but with dots from excel cell which when imported to dgv changes to #

and I don' want that to change, I don't know why is that happening????

I have a cell (among many) in excel worksheet DIR. FOR IT

and when I import excel to dgv that turns to this DIR# FOR IT

WHYYYYYYYYY

I dont want it to change

my sheet looks like this

ID	DIR. FOR IT
	test
	test1
	test2
	test3


my code for import is

string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 8.0;HDR=YES;IMEX=1;""", importfileCN);
                    string query = String.Format("select * from [{0}]", cmbExcelSheet1.Text);
                    OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, connectionString);
                    DataSet dataSet = new DataSet();
                    dataAdapter.Fill(dataSet);
                    dgCN.DataSource = dataSet.Tables[0];


dgCN is datagridview and everything works, but I get the name of the column like I said, DIR# FOR IT
Posted
Updated 24-Dec-13 23:32pm
v2
Comments
agent_kruger 25-Dec-13 5:08am    
please provide with image how does the excel sheet look like and how it is importing.

1 solution

i hope this link some help you.
Export to Excel from GridView in C#[^]
 
Share this answer
 

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