Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Write an excel file to XML file

guhan_77guhan_77 Posts: 7Member
i have coded like this

using System.Data.OleDb;
using System.Xml;
using System.IO;

protected void btnSubmit_Click(object sender, EventArgs e)
{
string strFileName;
if (UploadFile.PostedFile != null)
{
strFileName = UploadFile.PostedFile.FileName;
strFileName = strFileName.Substring(strFileName.LastIndexOf("\") + 1);
str="C:\Documents and Settings\134447\My Documents\a.xml";
try
{
paths = Server.MapPath("Attach/");
paths = paths + strFileName;
UploadFile.PostedFile.SaveAs(paths);

lblMessage.Text= "Uploaded successfully: c:\upload\" + strFileName + "
";
}
catch (Exception err)
{
lblMessage.Text= "Error Uploading c:\upload\" + strFileName + "
";
}



DataSet Mydataset = new DataSet();
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath("Attach/") + strFileName + ";" + "Extended Properties=Excel 11.0;IMEX=1;";
OleDbDataAdapter myData = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);

myData.AcceptChangesDuringFill = false;
//Fill Dataset
myData.Fill(Mydataset);
//Covert to XML
Mydataset.WriteXml(str);

}

We are using Excel 11.0 version in office 2003 .I am getting this error
"Could not find installable ISAM." - Excel OleDb

How to solve this problem?
Can anyone give the code?


Sign In or Register to comment.