469,364 Members | 2,346 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,364 developers. It's quick & easy.

convert excel to xml file

3
i use jet engine ,and oledb database but with this i get four errors which r compile time errores,plz help me to solve these errors
i wrote this programe bt it is not working .
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Net.Security;

public class oledbcon :System.Web.UI.Page
{

public static void main()
{

string connectionstring = " provider=microsoft.jet.oledb.4.0;" & "data source=" & country - State.xml & ";" & "extended properties = excel 8.0;hdr=yes; imex=1;";
OleDbConnection objconnection = new OleDbConnection(connectionstring);
objconnection.Open();
OleDbCommand objcmdselect=new OleDbCommand("select * from [sheet1$]",objconnection);
OleDbDataAdapter objadapter1=new OleDbDataAdapter();
objadapter1.SelectCommand=objcmdselect;
DataSet objdataset1=new DataSet();
objadapter1.Fill(objdataset1);
objconnection.Close();


}
}


errors:
1'.ASP.default_aspx.GetTypeHashCode()': no suitable method found to override
'2.ASP.default_aspx.ProcessRequest(System.Web.Http Context)': no suitable method found to override

3'ASP.default_aspx' does not implement interface member 'System.Web.IHttpHandler.IsReusable'

4ake sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Jun 29 '07 #1
3 2056
radcaesar
759 Expert 512MB
The following three things need to be done.

(a)

OLD: <%@ Page Language="C#" CompileWith="Default.aspx.cs" ClassName="Default_aspx" %>
NEW: <%@ Page Language="C#" codefile="Default.aspx.cs" Inherits="Default_aspx" %>

(b) In your ASPX.CS source file:

OLD: public partial class Default_aspx
NEW: public partial class Default_aspx : Page

(c)

OLD: sCallBackFunctionInvocation = this.GetCallbackEventReference(this, "message", "ShowServerTime", "context", "OnError");

NEW: sCallBackFunctionInvocation = Page.ClientScript.GetCallbackEventReference(this, "message", "ShowServerTime", "context", "OnError", false);

:)
Jun 29 '07 #2
binny
3
i write a code to convert excel to xml.
bt in this xml every time main tag closed
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Xml;
using System.Xml.XPath;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string st = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("countries-file.xls") + ";Extended Properties=Excel 8.0; ";
OleDbDataAdapter adp = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", st);
adp.TableMappings.Add("Table", "word");
DataSet ds = new DataSet();

adp.Fill(ds);
//XmlDataDocument doc=new XmlDataDocument(ds);
//doc.Save(Console.Out);

GridView1.DataSource = ds;
GridView1.DataBind();




out put it shows:
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table>
<COUNTRY>Canada</COUNTRY>
<STATE>Alberta </STATE>
<CITY>Airdrome</CITY>
</Table>
<Table>
<CITY>Calgary</CITY>
</Table>
<Table>
<CITY>Camrose</CITY>
</Table>
<Table>
<CITY>Canmore</CITY>
</Table>
<Table>
<CITY>Didzbury</CITY>
</Table>
<Table>
<CITY>Drayton Vally</CITY>
</Table>
<Table>
<CITY>Edmonton</CITY>
</Table>
bt i want
table tag closed only once at last
plz help me how iit is done
Jul 12 '07 #3
binny
3
i write a code to convert excel to xml.
bt in this xml every time main tag closed
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Xml;
using System.Xml.XPath;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string st = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("countries-file.xls") + ";Extended Properties=Excel 8.0; ";
OleDbDataAdapter adp = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", st);
adp.TableMappings.Add("Table", "word");
DataSet ds = new DataSet();

adp.Fill(ds);
//XmlDataDocument doc=new XmlDataDocument(ds);
//doc.Save(Console.Out);

GridView1.DataSource = ds;
GridView1.DataBind();




out put it shows:
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table>
<COUNTRY>Canada</COUNTRY>
<STATE>Alberta </STATE>
<CITY>Airdrome</CITY>
</Table>
<Table>
<CITY>Calgary</CITY>
</Table>
<Table>
<CITY>Camrose</CITY>
</Table>
<Table>
<CITY>Canmore</CITY>
</Table>
<Table>
<CITY>Didzbury</CITY>
</Table>
<Table>
<CITY>Drayton Vally</CITY>
</Table>
<Table>
<CITY>Edmonton</CITY>
</Table>
bt i want
table tag closed only once at last
plz help me how iit is done
Jul 12 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Andrew V. Romero | last post: by
2 posts views Thread by noopathan | last post: by
3 posts views Thread by Alain R. | last post: by
reply views Thread by Raymond Chiu | last post: by
15 posts views Thread by pakerly | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.