Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

hpires24

ReportViewer

Recommended Posts

Estou com o seguinte erro no report que nao consigo resolver o qual passo a citar:

 

A data source instance has not been supplied for the data source 'entredatas'

 

isto so me acontece quando eu tenho parametros de entrada na stored procedure ja batalhei dias e dias e nao consigo resolver tal erro necessitava de ajuda urgente se fazem favor.

 

stored procedure

ALTER	procedure [dbo].[ReportTesteEntreDatas_2]
@datainicioreserva  varchar(255),
@datafimreserva varchar (255)


as
select   
convert (varchar(10), a.datainicioreserva,105) as datainicioreserva , 
convert (time, a.datainicioreserva ) as horainicio,
convert (varchar(10), a.datafimreserva,105)  as datafimreserva, 
convert (time, a.datafimreserva ) as horainicio,

b.idTipoFrota,b.descTipoFrota,COUNT (a.idReserva) as cnt

from reserva a
inner join tipoFrota b on a.idTipoFrota = b.idTipoFrota

where  ((a.datainicioreserva > =  @datainicioreserva  or   @datainicioreserva < = a.datafimreserva) 
and  a.datainicioreserva< =  @datafimreserva ) 

group by a.datainicioreserva,  a.datafimreserva, b.idTipoFrota,b.descTipoFrota

 

o meu code em aspx é o seguinte:

 

rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
                   Height="350px" ShowFindControls="False" ShowRefreshButton="False" Width="100%" 
                               ZoomPercent="50" InteractiveDeviceInfos="(Collection)" 
                               WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">

                                 <LocalReport ReportPath="Report3.rdlc">
                                     <DataSources>
                                         <rsweb:ReportDataSource DataSourceId="Report_2" Name="entredatas" />
                                     </DataSources>
                                 </LocalReport>

                            </rsweb:ReportViewer>   
                            <asp:SqlDataSource ID="Report_2" runat="server" 
                               ConnectionString="<%$ ConnectionStrings:eskeletoConnectionString %>" 
                               SelectCommand="ReportTesteEntreDatas_2" SelectCommandType="StoredProcedure">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="tb_datahoraEnrtada" Name="datainicioreserva" 
                                        PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="tb_dataHoraRecolha" Name="datafimreserva" 
                                        PropertyName="Text" Type="String" />
                                </SelectParameters>
                           </asp:SqlDataSource>

estas duas textbox

tb_datahoraEnrtada e tb_dataHoraRecolha sao onde insiro as datas para os quais pretendo ver o report

o meu codebehind no botao de procura é o seguinte

Dim a As String
       Dim b As String
       a = tb_datahoraEnrtada.Text
       b = tb_dataHoraRecolha.Text


       ReportViewer1.Reset()
       ReportViewer1.ProcessingMode = ProcessingMode.Local
       Dim rep As LocalReport = ReportViewer1.LocalReport
       rep.ReportPath = "Report3.rdlc"



       Dim ds As DataSet = Getenrtedatas(a, B)/> 'GetPropostaData(lblIdProposta.Text)
       Dim dsSalesOrder As New ReportDataSource()
       dsSalesOrder.Name = "entredatas_ReportTesteEntreDatas_2"
       dsSalesOrder.Value = ds.Tables("rentredatas")



       '  AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf Me.SubreportProcessingEventHandler

       Me.ReportViewer1.Enabled = True
       Me.ReportViewer1.Visible = True




   End Sub


   Private Function Getenrtedatas(ByVal dataentrada As String, ByVal datasaida As String) As DataSet

       Dim ds As New DataSet
       Dim sqlSalesData As String = "ReportTesteEntreDatas_2"
       Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("eskeletoConnectionString").ToString)
           Dim command As New SqlCommand(sqlSalesData, connection)
           command.CommandType = CommandType.StoredProcedure



           command.Parameters.Add("@datainicioreserva", SqlDbType.VarChar)
           command.Parameters("@datainicioreserva").Value = dataentrada

           command.Parameters.Add("@datafimreserva", SqlDbType.VarChar)
           command.Parameters("@datafimreserva").Value = datasaida

           Dim salesOrderAdapter As New SqlDataAdapter(command)
           salesOrderAdapter.Fill(ds, "rentredatas")
           salesOrderAdapter.Dispose()
           command.Dispose()
       End Using
       Return ds
   End Function

 

 

e da-me o erro A data source instance has not been supplied for the data source 'entredatas' caso seja uma storedprocedure que nao tenha parametros de entrada da tudo correcto

podiam ajudar-me é super urgente

Helder Pires e desde ja muito obrigado

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.