473,738 Members | 7,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URGENT Error: CS0117: 'System.Data.Da taTable' does not contain a definition for 'WriteXml'

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0117: 'System.Data.Da taTable' does not contain a
definition for 'WriteXml'

Source Error:

Line 55: da.Fill(Datos, "Datos");
Line 56: Session["Tabla"]=ListaTabla.Sel ectedItem.Text;
Line 57:
Datos.Tables["Datos"].WriteXml(Serve r.MapPath(Sessi on["Tabla"] + ".xml"));
Line 58: DataGrid1.DataS ource=Datos;
Line 59: DataGrid1.DataB ind();
Source File: c:\inetpub\wwwr oot\PDM\excel\D efault.aspx Line: 57

The code:
<%@ Page Language="c#" Debug="true" %>
<%@ import Namespace="Syst em.Data" %>
<%@ import Namespace="Syst em.Xml" %>
<%@ import Namespace="Syst em.Xml.Xsl" %>
<%@ import Namespace="Syst em.Data.SqlClie nt" %>
<HTML>
<HEAD>
<script runat="server">

//definimos como publica la conexion a la base de datos
public SqlConnection conDB = new SqlConnection() ;

public void Page_Load(Objec t sender, EventArgs E) {
//la primera vez que carga la pagina obtenemos la lista de Bases de
datos
if (Page.IsPostBac k == false) {
conDB.Connectio nString = "data
source=10.195.1 7.7;database=de vnew;uid=cupryk ma;pwd=ehs123";
/*con "sp_databas es" obtenemos la lista de bases de datos en una
instancia de SQL Server
para MySQL se usa "show databases" */
SqlDataAdapter da = new SqlDataAdapter( "sp_databas es", conDB);
DataSet ds = new DataSet();
da.Fill(ds, "DBases");
ListaDB.DataSou rce=ds;
//filtramos los datos y solo asociamos la columna "DATABASE_N AME" al
dropdownlist
ListaDB.DataTex tField="DATABAS E_NAME";
ListaDB.DataBin d();
}
}

void DropDownList1_S electedIndexCha nged(object sender, EventArgs e) {
//como ya el usuario selecciono una base de datos activamos el boton
de consultas
Consultar.Enabl ed=true;
conDB.Connectio nString = "data source=10.195.1 7.7;initial catalog="
+ ListaDB.Selecte dItem.Text + ";integrate d security=SSPI;p ersist security
info=False;uid= cuprykma;pwd=eh s123;packet size=4096";
/*con la cosulta "select * from SYSOBJECTS where TYPE = 'U' and name
<> 'dtproperties' order by NAME"
obtenemos todas las tablas de usuario que hay en una base de datos.
en MySQL usamos "show tables" y en Oracle Usamos "select * from
tab;"*/
SqlDataAdapter da = new SqlDataAdapter( "select * from SYSOBJECTS
where TYPE = 'U' and name <> 'dtproperties' order by NAME", conDB);
DataSet ds = new DataSet();
da.Fill(ds, "Tablas");
ListaTabla.Data Source=ds;
//filtramos de nuevo, ahora solo nos intersa la columna "name" con
los nombres de la tablas
ListaTabla.Data TextField="name ";
ListaTabla.Data Bind();
//aparecemos el boton para hacer la conversion a excel
Convertir.Visib le=false;
//y desaparecemos el de consulta
Consultar.Visib le=true;
}

public DataSet Datos = new DataSet();

public void Consultar_Click (object sender, EventArgs e) {
conDB.Connectio nString = "data source=10.195.1 7.7;initial catalog="
+ ListaDB.Selecte dItem.Text + ";integrate d security=SSPI;p ersist security
info=False;uid= cuprykma;pwd=eh s123;packet size=4096";
//traemos los datos de la tabla usando la BD selecionada en
ListaTabla y la tabla seleccionada
SqlDataAdapter da = new SqlDataAdapter( "select * from " +
ListaTabla.Sele ctedItem.Text, conDB);
da.Fill(Datos, "Datos");
Session["Tabla"]=ListaTabla.Sel ectedItem.Text;
Datos.Tables["Datos"].WriteXml(Serve r.MapPath(Sessi on["Tabla"] +
".xml"));
DataGrid1.DataS ource=Datos;
DataGrid1.DataB ind();
Consultar.Visib le=false;
Convertir.Visib le=true;
}

void Button1_Click(o bject sender, EventArgs e) {
Response.Conten tType = "applicatio n/vnd.ms-excel";
Response.Charse t = "";
DataSet ds = new DataSet();
ds.ReadXml(Serv er.MapPath(Sess ion["Tabla"] + ".xml"));
XmlDataDocument xdd = new XmlDataDocument (ds);
XslTransform xt = new XslTransform();
xt.Load(Server. MapPath("Excel. xsl"));
xt.Transform(xd d, null, Response.Output Stream);
Response.End();
}

</script>
</HEAD>
<body>
<form runat="server" ID="Form1">
<asp:HyperLin k id="HyperLink1 " runat="server"
NavigateUrl="Ba ck">Propertie s</asp:HyperLink>
<table cellspacing="3" cellpadding="7" align="center">
<tbody>
<tr>
<td>
Database</td>
<td>
Table</td>
</tr>
<tr>
<td>
<asp:DropDownLi st id="ListaDB"
runat="server" OnSelectedIndex Changed="DropDo wnList1_Selecte dIndexChanged"

AutoPostBack="T rue"></asp:DropDownLis t>
</td>
<td>
<asp:DropDownLi st id="ListaTabla "
runat="server">
<asp:ListItem
Value="(Tablas) ">(Tables)</asp:ListItem>
</asp:DropDownLis t>
</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<asp:Button id="Consultar"
onclick="Consul tar_Click" runat="server" Text="Consultar "
Enabled="False" ></asp:Button>
<asp:Button id="Convertir"
onclick="Button 1_Click" runat="server" Text="Convert To Excel"
Visible="False" ></asp:Button>
</div>
</td>
</tr>
</tbody>
</table>
<p>
</p>
<p align="center">
<asp:DataGrid id="DataGrid1" runat="server"
BorderStyle="No ne" BorderWidth="1p x" BorderColor="#C C9966"
BackColor="Whit e" CellPadding="4" >
<FooterStyle forecolor="#330 099"
backcolor="#FFF FCC"></FooterStyle>
<HeaderStyle font-bold="True" forecolor="#FFF FCC"
backcolor="#990 000"></HeaderStyle>
<PagerStyle horizontalalign ="Center"
forecolor="#330 099" backcolor="#FFF FCC"></PagerStyle>
<SelectedItemSt yle font-bold="True"
forecolor="#663 399" backcolor="#FFC C66"></SelectedItemSty le>
<ItemStyle forecolor="#330 099"
backcolor="Whit e"></ItemStyle>
</asp:DataGrid>
</p>
</form>
</body>
</HTML>

--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/
Nov 19 '05 #1
1 6795
Vko
This method is only defined for DataSet not for DataTable.

Replace :
Datos.Tables["Datos"].WriteXml(Serve r.MapPath(Sessi on["Tabla"] + ".xml"));
by
Datos.WriteXml( Server.MapPath( Session["Tabla"] + ".xml"));
"Luis Esteban Valencia" wrote:
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0117: 'System.Data.Da taTable' does not contain a
definition for 'WriteXml'

Source Error:

Line 55: da.Fill(Datos, "Datos");
Line 56: Session["Tabla"]=ListaTabla.Sel ectedItem.Text;
Line 57:
Datos.Tables["Datos"].WriteXml(Serve r.MapPath(Sessi on["Tabla"] + ".xml"));
Line 58: DataGrid1.DataS ource=Datos;
Line 59: DataGrid1.DataB ind();
Source File: c:\inetpub\wwwr oot\PDM\excel\D efault.aspx Line: 57

The code:
<%@ Page Language="c#" Debug="true" %>
<%@ import Namespace="Syst em.Data" %>
<%@ import Namespace="Syst em.Xml" %>
<%@ import Namespace="Syst em.Xml.Xsl" %>
<%@ import Namespace="Syst em.Data.SqlClie nt" %>
<HTML>
<HEAD>
<script runat="server">

//definimos como publica la conexion a la base de datos
public SqlConnection conDB = new SqlConnection() ;

public void Page_Load(Objec t sender, EventArgs E) {
//la primera vez que carga la pagina obtenemos la lista de Bases de
datos
if (Page.IsPostBac k == false) {
conDB.Connectio nString = "data
source=10.195.1 7.7;database=de vnew;uid=cupryk ma;pwd=ehs123";
/*con "sp_databas es" obtenemos la lista de bases de datos en una
instancia de SQL Server
para MySQL se usa "show databases" */
SqlDataAdapter da = new SqlDataAdapter( "sp_databas es", conDB);
DataSet ds = new DataSet();
da.Fill(ds, "DBases");
ListaDB.DataSou rce=ds;
//filtramos los datos y solo asociamos la columna "DATABASE_N AME" al
dropdownlist
ListaDB.DataTex tField="DATABAS E_NAME";
ListaDB.DataBin d();
}
}

void DropDownList1_S electedIndexCha nged(object sender, EventArgs e) {
//como ya el usuario selecciono una base de datos activamos el boton
de consultas
Consultar.Enabl ed=true;
conDB.Connectio nString = "data source=10.195.1 7.7;initial catalog="
+ ListaDB.Selecte dItem.Text + ";integrate d security=SSPI;p ersist security
info=False;uid= cuprykma;pwd=eh s123;packet size=4096";
/*con la cosulta "select * from SYSOBJECTS where TYPE = 'U' and name
<> 'dtproperties' order by NAME"
obtenemos todas las tablas de usuario que hay en una base de datos.
en MySQL usamos "show tables" y en Oracle Usamos "select * from
tab;"*/
SqlDataAdapter da = new SqlDataAdapter( "select * from SYSOBJECTS
where TYPE = 'U' and name <> 'dtproperties' order by NAME", conDB);
DataSet ds = new DataSet();
da.Fill(ds, "Tablas");
ListaTabla.Data Source=ds;
//filtramos de nuevo, ahora solo nos intersa la columna "name" con
los nombres de la tablas
ListaTabla.Data TextField="name ";
ListaTabla.Data Bind();
//aparecemos el boton para hacer la conversion a excel
Convertir.Visib le=false;
//y desaparecemos el de consulta
Consultar.Visib le=true;
}

public DataSet Datos = new DataSet();

public void Consultar_Click (object sender, EventArgs e) {
conDB.Connectio nString = "data source=10.195.1 7.7;initial catalog="
+ ListaDB.Selecte dItem.Text + ";integrate d security=SSPI;p ersist security
info=False;uid= cuprykma;pwd=eh s123;packet size=4096";
//traemos los datos de la tabla usando la BD selecionada en
ListaTabla y la tabla seleccionada
SqlDataAdapter da = new SqlDataAdapter( "select * from " +
ListaTabla.Sele ctedItem.Text, conDB);
da.Fill(Datos, "Datos");
Session["Tabla"]=ListaTabla.Sel ectedItem.Text;
Datos.Tables["Datos"].WriteXml(Serve r.MapPath(Sessi on["Tabla"] +
".xml"));
DataGrid1.DataS ource=Datos;
DataGrid1.DataB ind();
Consultar.Visib le=false;
Convertir.Visib le=true;
}

void Button1_Click(o bject sender, EventArgs e) {
Response.Conten tType = "applicatio n/vnd.ms-excel";
Response.Charse t = "";
DataSet ds = new DataSet();
ds.ReadXml(Serv er.MapPath(Sess ion["Tabla"] + ".xml"));
XmlDataDocument xdd = new XmlDataDocument (ds);
XslTransform xt = new XslTransform();
xt.Load(Server. MapPath("Excel. xsl"));
xt.Transform(xd d, null, Response.Output Stream);
Response.End();
}

</script>
</HEAD>
<body>
<form runat="server" ID="Form1">
<asp:HyperLin k id="HyperLink1 " runat="server"
NavigateUrl="Ba ck">Propertie s</asp:HyperLink>
<table cellspacing="3" cellpadding="7" align="center">
<tbody>
<tr>
<td>
Database</td>
<td>
Table</td>
</tr>
<tr>
<td>
<asp:DropDownLi st id="ListaDB"
runat="server" OnSelectedIndex Changed="DropDo wnList1_Selecte dIndexChanged"

AutoPostBack="T rue"></asp:DropDownLis t>
</td>
<td>
<asp:DropDownLi st id="ListaTabla "
runat="server">
<asp:ListItem
Value="(Tablas) ">(Tables)</asp:ListItem>
</asp:DropDownLis t>
</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<asp:Button id="Consultar"
onclick="Consul tar_Click" runat="server" Text="Consultar "
Enabled="False" ></asp:Button>
<asp:Button id="Convertir"
onclick="Button 1_Click" runat="server" Text="Convert To Excel"
Visible="False" ></asp:Button>
</div>
</td>
</tr>
</tbody>
</table>
<p>
</p>
<p align="center">
<asp:DataGrid id="DataGrid1" runat="server"
BorderStyle="No ne" BorderWidth="1p x" BorderColor="#C C9966"
BackColor="Whit e" CellPadding="4" >
<FooterStyle forecolor="#330 099"
backcolor="#FFF FCC"></FooterStyle>
<HeaderStyle font-bold="True" forecolor="#FFF FCC"
backcolor="#990 000"></HeaderStyle>
<PagerStyle horizontalalign ="Center"
forecolor="#330 099" backcolor="#FFF FCC"></PagerStyle>
<SelectedItemSt yle font-bold="True"
forecolor="#663 399" backcolor="#FFC C66"></SelectedItemSty le>
<ItemStyle forecolor="#330 099"
backcolor="Whit e"></ItemStyle>
</asp:DataGrid>
</p>
</form>
</body>
</HTML>

--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9187
by: RichW | last post by:
I've seen a couple other posts on this but no real answers. I'm trying to do a bulk insert and everything is fine until I run the objCom.ExecuteNonQuery() statement at which point I get the XML parsing error. Of course, it would be easy to simply wrap unicode characters with CDATA <!]> but is this doable when passing values to fields to create a row since a whole row is treated as a single element? I.e.: <FileProperty...
2
2061
by: Patrick Huffer | last post by:
When I open a certain page, I receive a "Compilation Error" as follows: Compiler Error Message: CS0117: 'System.Web.UI.HtmlControls.HtmlForm' does not contain a definition for 'ValidateInput' Source Error: Line 712: this.EnableViewStateMac = true; Line 713: this.SmartNavigation = true; Line 714: this.Request.ValidateInput();
3
2044
by: Justin Dutoit | last post by:
Hey. I have the error CS0117 'BusinessLayer' does not contain a definition for 'MySoapHeader'. Below is a link to the asmx source, and the code which calls the web service. MS seems to do the same thing at http://www.dotnetjunkies.com/QuickStart/aspplus/default.aspx?url=/quickstart /aspplus/doc/secureservices.aspx I'd appreciate any help. Thanks Justin Dutoit
17
2768
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1 first, and the mydataset1 data source was getting from DataGrid.DataSource.
13
10141
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the parent table. ----------------------------
9
2948
by: PeterWellington | last post by:
I have a column in a data table that stores enum values and assigns a default value: Dim dc As New DataColumn("TestEnumField", GetType(DayOfWeek)) dc.DefaultValue = DayOfWeek.Thursday When I try to serialize/deserialize dataset schema, I get the error below during deserialization: "System.ArgumentException: The DefaultValue for column TestEnumField is of
4
2891
by: B. | last post by:
Hi I have two projects, one written in MC++, and the other in C#. In MC++ header file, I have: namespace Domain { namespace Subdomain { namespace ManagedCPP { public class AClass
4
2319
by: Neo Geshel | last post by:
Just moved to C# from VB.NET, frustrated to hell and back by inability to get much-copied (from about 20+ different resources) literal example to work. Master Page content: <meta name="keywords" content="<asp:Literal ID="ltrlKeywords" Runat="server" />"></meta> Code-Behind:
5
1206
by: preeti13 | last post by:
Hi friends i am getting the error in my application i don't know what to do please help me.i am useing a data bimder into my text box here is the my code <%@ Page language="c#" Codebehind="Accomplishment.aspx.cs" AutoEventWireup="false" Inherits="Accomplishments.Accomplishment" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>Accomplishment</title> <meta content="Microsoft Visual Studio .NET...
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.