Click here to Skip to main content
15,904,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have completed fetch 100 row data from excel file and storein data base but I can't read 3rd row data FN3VCAP3250 value and can't store in database. because its show in dataset is null.
Please help me, It's Urgent.



008837-VibramycinSyrup 207565 375.32

037234-Derma3TwistCapLarge 207560 60.17

008836-VibramycinSuspension FN3VCAP3250 34.07


Use this Code-:
C#
if (flUpload.HasFile)
                {
                    string path = Server.MapPath("~/Administrator/UploadedExcelFile/");
                    flUpload.SaveAs(path + flUpload.FileName);
                    string path1 = Server.MapPath("~/Administrator/UploadedExcelFile/" + flUpload.FileName);

                    OleDbConnection MyConnection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + path1 + "';Extended Properties=Excel 12.0;");
                    OleDbDataAdapter MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection);
                    DtSet = new System.Data.DataSet();

                    //Bind all excel data in to data set
                    MyCommand.Fill(DtSet, "[Sheet1$]");
                    DataTable dt = new DataTable();
                    dt = DtSet.Tables[0];
                    MyConnection.Close();
                    //ViewState["myTable"] = dt;
                    if (dt != null)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
}
}
Posted
Updated 8-Jan-14 22:08pm
v4
Comments
Karthik_Mahalingam 9-Jan-14 4:11am    
post full code.

1 solution

check the count of table rows and see if that count is proper or not. use quick watch to view the data in the datatable and see if you have all the records from excel sheet.
 
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