As per my requirement there is need of Uploding Excel data in SQL Server 2008
But there is one issue.....
WHEN I am uploading an Excel sheet and showing it's content in Gridview and then I am storing it in SQL Server 2008 database;
In the GridView, Excel data is showing perfectly, but when I am storing it into the database, then at the end of string  
is inserted...
Stored data in table is PETER 
while it should be PETER
I have tried using the .Trim()
method also but nothing is worked
foreach (GridViewRow g1 in grvExcelData.Rows)
{
try
{
name = grvExcelData.Rows[g1.RowIndex].Cells[2].Text.Trim();
Here's a sample of my data:
96086 IT085 PATEL RUCHIKKUMAR MAHENDRABHAI  IT 6 2009-13
 
or
is the html code for non breaking space .
Use this to get rid of it.
name = grvExcelData.Rows[g1.RowIndex].Cells[2].Text.Replace(@" ", "");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.