Database Login when generating report in Crystal Reports VS2008 - VB.NET

Asked

Viewed 342 times

1

Good morning late evening

I already know that there are some topics related to this same issue that I am raising, but none participated in exactly the same conditions that led to the same event, as well as?

Well, come on!

  • I imported the Datasets as well as their respective rpts from another project and.Vb report forms.
  • I added as a reference in the project the . exe of the other application.
  • I went to Set Datasource Location of the rpts and changed the Class Name to the current project.

The need to import these existing items is that the application in question will need to generate the same reports as the other.

I implemented a few more things in the project and everything right, but when generating the report asks for login and password of the Dataset in which I play the information handled. I have several Datasets for various reports.

Thanks in advance for any participation.

Follow the example of one of the call types to generate the report.

Sub ResultadoProgesterona(ByVal C As String, ByVal N As String, ByVal Imprimir As Boolean)

        Dim SqlStr As String = "SELECT UTILIZAD"
        Dim Con As New SqlConnection(myConnStr)
        Con.Open()
        Dim SqlAdapter As New SqlDataAdapter()
        Dim DtSet As New DataSet
        SqlAdapter.SelectCommand = New SqlCommand(SqlStr, Con)
        SqlAdapter.Fill(DtSet, "ExameItem")
        Dim row As DataRow
        row = DtSet.Tables(0).NewRow()

        DtSet.Tables(0).Rows.Add(row)
        RelatorioProgesterona.RelProgesterona1.SetDataSource(DtSet)
        RelatorioProgesterona.RelProgesterona1.SetParameterValue("", DtSet.Tables(0).Rows(0).Item(0))
        RelatorioProgesterona.RelProgesterona1.SetParameterValue("", DtSet.Tables(0).Rows(0).Item(1))
        RelatorioProgesterona.RelProgesterona1.SetParameterValue("", DtSet.Tables(0).Rows(0).Item(6))
        RelatorioProgesterona.RelProgesterona1.SetParameterValue("", DtSet.Tables(0).Rows(0).Item(3))
        RelatorioProgesterona.RelProgesterona1.SetParameterValue("", DtSet.Tables(0).Rows(0).Item(4))
        RelatorioProgesterona.RelProgesterona1.SetParameterValue("", N)
        RelatorioProgesterona.RelProgesterona1.SetParameterValue("", DtSet.Tables(0).Rows(0).Item(5))
        RelatorioProgesterona.RelProgesterona1.SetParameterValue("", DtSet.Tables(0).Rows(0).Item(2))
        If Imprimir Then
            RelatorioProgesterona.RelProgesterona1.PrintToPrinter(1, False, 1, 1)
        Else

            CarregaForm(RelatorioProgesterona, pprincipal)
            RelatorioProgesterona.WindowState = FormWindowState.Maximized

        End If

        DtSet.Dispose()
        DtSet = Nothing
        SqlAdapter.Dispose()
        SqlAdapter = Nothing
        Con.Close()
        Con.Dispose()
        Con = Nothing
End Sub

EXEMPLO

  • 1

    Andrew, there is no problem in yourself posting the answer to your problem. Please publish the answer to your problem (as an answer). Then everyone will know that their doubt has been resolved and will be able to consult their methods.

1 answer

1


In addition to doing all the steps mentioned above lacked one more:

  • I imported from another project Datasets and their respective .rpts and the forms of report.Vb.
  • I added as a reference to the .exe of the other application.
  • I went on set Datasource Location of the rpts and changed the Class Name to the current project.
  • Go on the estates of Crystalreportviewer and Change the Reportsource to the reference of the current project.

inserir a descrição da imagem aqui

I hope I can help someone who goes through the same difficulty. []’s

Browser other questions tagged

You are not signed in. Login or sign up in order to post.