fagnerx21 0 Denunciar post Postado Dezembro 24, 2007 Olá, eu estou tentando criar uma página asp.net pra visualizar um relatório de cadastro de clientes, criei um objeto reportviewer e testei com o banco Northwind.mdb,criei o relatório,coloquei uma tabela e os campos em cada célula da tabela do relatório,depois eu associei o relatório ao reportviewer, mas qdo testo gera um erro esquisito, se alguém puder ajudar eu fico grato. Default.aspx: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <span style="font-size: 25px; color: blue"><strong>Gerando Relatórios Através do ReportViewer<br /> <br /> <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="400px" Width="800px"> <LocalReport ReportPath="Report1.rdlc"> <DataSources> <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1_Clientes" /> </DataSources> </LocalReport> </rsweb:ReportViewer> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="DataSet1TableAdapters.ClientesTableAdapter"></asp:ObjectDataSource> </strong></span> </div> </form> </body> </html> App_Code/DataSet1.xsd: <?xml version="1.0" encoding="utf-8"?> <xs:schema id="DataSet1" targetNamespace="http://tempuri.org/DataSet1.xsd" xmlns:mstns="http://tempuri.org/DataSet1.xsd" xmlns="http://tempuri.org/DataSet1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified"> <xs:annotation> <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource"> <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> <Connections> <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="cn" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="cn (Web.config)" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.cn. ConnectionString" Provider="System.Data.OleDb"> </Connection> </Connections> <Tables> <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="ClientesTableAdapter" GeneratorDataComponentClassName="ClientesTableAdapter" Name="Clientes" UserDataComponentName="ClientesTableAdapter"> <MainSource> <DbSource ConnectionRef="cn (Web.config)" DbObjectName="Clientes" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="True" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetData" UserSourceName="Fill"> <DeleteCommand> <DbCommand CommandType="Text" ModifiedByUser="False"> <CommandText>DELETE FROM `Clientes` WHERE ((`CódigoDoCliente` = ?))</CommandText> <Parameters> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Original_CódigoDoCliente" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="CódigoDoCliente" SourceColumnNullMapping="False" SourceVersion="Original"> </Parameter> </Parameters> </DbCommand> </DeleteCommand> <InsertCommand> <DbCommand CommandType="Text" ModifiedByUser="False"> <CommandText>INSERT INTO `Clientes` (`CódigoDoCliente`, `NomeDaEmpresa`, `NomeDoContato`, `CargoDoContato`, `Endereço`, `Cidade`, `Região`, `CEP`, `País`, `Telefone`, `Fax`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)</CommandText> <Parameters> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="CódigoDoCliente" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="CódigoDoCliente" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="NomeDaEmpresa" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="NomeDaEmpresa" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="NomeDoContato" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="NomeDoContato" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="CargoDoContato" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="CargoDoContato" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Endereço" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Endereço" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Cidade" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Cidade" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Região" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Região" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="CEP" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="CEP" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="País" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="País" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Telefone" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Telefone" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Fax" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Fax" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> </Parameters> </DbCommand> </InsertCommand> <SelectCommand> <DbCommand CommandType="Text" ModifiedByUser="True"> <CommandText>SELECT Clientes.* FROM Clientes</CommandText> <Parameters> </Parameters> </DbCommand> </SelectCommand> <UpdateCommand> <DbCommand CommandType="Text" ModifiedByUser="False"> <CommandText>UPDATE `Clientes` SET `CódigoDoCliente` = ?, `NomeDaEmpresa` = ?, `NomeDoContato` = ?, `CargoDoContato` = ?, `Endereço` = ?, `Cidade` = ?, `Região` = ?, `CEP` = ?, `País` = ?, `Telefone` = ?, `Fax` = ? WHERE ((`CódigoDoCliente` = ?))</CommandText> <Parameters> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="CódigoDoCliente" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="CódigoDoCliente" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="NomeDaEmpresa" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="NomeDaEmpresa" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="NomeDoContato" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="NomeDoContato" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="CargoDoContato" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="CargoDoContato" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Endereço" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Endereço" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Cidade" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Cidade" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Região" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Região" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="CEP" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="CEP" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="País" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="País" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Telefone" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Telefone" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Fax" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="Fax" SourceColumnNullMapping="False" SourceVersion="Current"> </Parameter> <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="Original_CódigoDoCliente" Precision="0" ProviderType="VarWChar" Scale="0" Size="0" SourceColumn="CódigoDoCliente" SourceColumnNullMapping="False" SourceVersion="Original"> </Parameter> </Parameters> </DbCommand> </UpdateCommand> </DbSource> </MainSource> <Mappings> <Mapping SourceColumn="CódigoDoCliente" DataSetColumn="CódigoDoCliente" /> <Mapping SourceColumn="NomeDaEmpresa" DataSetColumn="NomeDaEmpresa" /> <Mapping SourceColumn="NomeDoContato" DataSetColumn="NomeDoContato" /> <Mapping SourceColumn="CargoDoContato" DataSetColumn="CargoDoContato" /> <Mapping SourceColumn="Endereço" DataSetColumn="Endereço" /> <Mapping SourceColumn="Cidade" DataSetColumn="Cidade" /> <Mapping SourceColumn="Região" DataSetColumn="Região" /> <Mapping SourceColumn="CEP" DataSetColumn="CEP" /> <Mapping SourceColumn="País" DataSetColumn="País" /> <Mapping SourceColumn="Telefone" DataSetColumn="Telefone" /> <Mapping SourceColumn="Fax" DataSetColumn="Fax" /> </Mappings> <Sources> </Sources> </TableAdapter> </Tables> <Sources> </Sources> </DataSource> </xs:appinfo> </xs:annotation> <xs:element name="DataSet1" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="DataSet1" msprop:Generator_DataSetName="DataSet1"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="Clientes" msprop:Generator_UserTableName="Clientes" msprop:Generator_RowDeletedName="ClientesRowDeleted" msprop:Generator_TableClassName="ClientesDataTable" msprop:Generator_RowChangedName="ClientesRowChanged" msprop:Generator_RowClassName="ClientesRow" msprop:Generator_RowChangingName="ClientesRowChanging" msprop:Generator_RowEvArgName="ClientesRowChangeEvent" msprop:Generator_RowEvHandlerName="ClientesRowChangeEventHandler" msprop:Generator_TablePropName="Clientes" msprop:Generator_TableVarName="tableClientes" msprop:Generator_RowDeletingName="ClientesRowDeleting"> <xs:complexType> <xs:sequence> <xs:element name="CódigoDoCliente" msprop:Generator_UserColumnName="CódigoDoCliente" msprop:Generator_ColumnPropNameInRow="CódigoDoCliente" msprop:Generator_ColumnVarNameInTable="columnCódigoDoCliente" msprop:Generator_ColumnPropNameInTable="CódigoDoClienteColumn"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="5" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="NomeDaEmpresa" msprop:Generator_UserColumnName="NomeDaEmpresa" msprop:Generator_ColumnPropNameInRow="NomeDaEmpresa" msprop:Generator_ColumnVarNameInTable="columnNomeDaEmpresa" msprop:Generator_ColumnPropNameInTable="NomeDaEmpresaColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="40" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="NomeDoContato" msprop:Generator_UserColumnName="NomeDoContato" msprop:Generator_ColumnPropNameInRow="NomeDoContato" msprop:Generator_ColumnVarNameInTable="columnNomeDoContato" msprop:Generator_ColumnPropNameInTable="NomeDoContatoColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="30" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="CargoDoContato" msprop:Generator_UserColumnName="CargoDoContato" msprop:Generator_ColumnPropNameInRow="CargoDoContato" msprop:Generator_ColumnVarNameInTable="columnCargoDoContato" msprop:Generator_ColumnPropNameInTable="CargoDoContatoColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="30" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="Endereço" msprop:Generator_UserColumnName="Endereço" msprop:Generator_ColumnPropNameInRow="Endereço" msprop:Generator_ColumnVarNameInTable="columnEndereço" msprop:Generator_ColumnPropNameInTable="EndereçoColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="60" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="Cidade" msprop:Generator_UserColumnName="Cidade" msprop:Generator_ColumnPropNameInRow="Cidade" msprop:Generator_ColumnVarNameInTable="columnCidade" msprop:Generator_ColumnPropNameInTable="CidadeColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="15" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="Região" msprop:Generator_UserColumnName="Região" msprop:Generator_ColumnPropNameInRow="Região" msprop:Generator_ColumnVarNameInTable="columnRegião" msprop:Generator_ColumnPropNameInTable="RegiãoColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="15" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="CEP" msprop:Generator_UserColumnName="CEP" msprop:Generator_ColumnPropNameInRow="CEP" msprop:Generator_ColumnVarNameInTable="columnCEP" msprop:Generator_ColumnPropNameInTable="CEPColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="10" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="País" msprop:Generator_UserColumnName="País" msprop:Generator_ColumnPropNameInRow="País" msprop:Generator_ColumnVarNameInTable="columnPaís" msprop:Generator_ColumnPropNameInTable="PaísColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="15" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="Telefone" msprop:Generator_UserColumnName="Telefone" msprop:Generator_ColumnPropNameInRow="Telefone" msprop:Generator_ColumnVarNameInTable="columnTelefone" msprop:Generator_ColumnPropNameInTable="TelefoneColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="24" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="Fax" msprop:Generator_UserColumnName="Fax" msprop:Generator_ColumnPropNameInRow="Fax" msprop:Generator_ColumnVarNameInTable="columnFax" msprop:Generator_ColumnPropNameInTable="FaxColumn" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="24" /> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> <xs:unique name="Constraint1" msdata:PrimaryKey="true"> <xs:selector xpath=".//mstns:Clientes" /> <xs:field xpath="mstns:CódigoDoCliente" /> </xs:unique> </xs:element> </xs:schema> Web.Config: <?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config --> <configuration> <appSettings/> <connectionStrings> <add name="cn" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Northwind.mdb;Persist Security Info=True" providerName="System.Data.OleDb" /> </connectionStrings> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <httpHandlers> <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" /> </httpHandlers> <compilation debug="false"> <buildProviders> <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </buildProviders> </compilation> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" /> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> </system.web> </configuration> ErrorLog: Error 102 Unable to convert input xml file content to a DataSet. Invalid 'name' attribute value 'CódigoDoCliente': 'The '³' character, hexadecimal value 0xB3, at position 2 within the name, cannot be included in a name.'. C:\Documents and Settings\Administrador\Meus documentos\Visual Studio 2005\WebSites\ReportViewer\App_Code\DataSet1.xsd 1 Por favor, me ajudem. Obrigado Compartilhar este post Link para o post Compartilhar em outros sites
quintelab 91 Denunciar post Postado Dezembro 26, 2007 Pelo erro, o problema esta na palavra que você utilizou com acento, CódigoDoCliente. Tire a acentuação... Compartilhar este post Link para o post Compartilhar em outros sites