Click here to Skip to main content
15,919,178 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello i am writing a Asp.net application with backend mysql5.0
i have a .xlsx file which i have to upload and read the data into mysql table.

Any one have any simalar code.

i had tried code-

C#
string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                                                       "Data Source=" + Path + ";" +
                                                       "Extended Properties=\"Excel 12.0 Xml;HDR=YES\"";
            using (OleDbConnection cn = new OleDbConnection(ConnectionString))
            {
                cn.Open();

DataTable dbSchema = cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (dbSchema == null || dbSchema.Rows.Count < 1)
}

but i throughs an exception like Could not find installable ISAM..
Any suggestion !!
Posted
Updated 21-Oct-12 21:24pm
v2

please download the files from
"http://www.microsoft.com/en-us/download/details.aspx?id=13255" and install it.
 
Share this answer
 
try this,
C#
if (hdnImageValues.Value != "")
           {
               string filePath = @"D:\Images\" + hdnImageValues.Value;
               string fileName = hdnImageValues.Value;

               if (File.Exists(filePath))
               {

                   FileStream fs = File.Open(filePath, FileMode.Open);

                   byte[] fsbyte = null;

                   fsbyte = new byte[fs.Length];

                   fs.Read(fsbyte, 0, Convert.ToInt32(fs.Length, null));

                   fs.Close();
             Response.AddHeader("contentdisposition","attachment;filename=" + fileName);

                   Response.BinaryWrite(fsbyte);

                   Response.End();

               }

           }
 
Share this answer
 
v2

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