I have a Crystal Report that I am trying to access thru my VB.Net app. My problem is that I keep getting a "Database Logon" prompt (see screenshot). My code is below and I think I might have more than I actually need. I created the report from with the VS 2008 IDE.
Code:Private Sub rptSingleWorkOrder() Try strSQL = "Select A.productName, " & _ "A.productDesc, " & _ "A.startDate, " & _ "A.endDate, " & _ "A.totalCost, " & _ "A.laborRate, " & _ "A.wrkID, " & _ "B.componentName, " & _ "B.reqdPieces, " & _ "B.totalCost, " & _ "B.specialInstruction, " & _ "B.imageLocation " & _ "From tblWorkOrderMst A INNER JOIN tblWorkOrderDet B ON " & _ "A.wrkID = B.wrkID " & _ "Where A.wrkID = '" & mWOID & "'" Dim cr As New rptWorkOrder Dim sel As New SqlCommand(strSQL, cnn) DA.SelectCommand = sel DA.Fill(DS) cr.RecordSelectionFormula = "{tblWorkOrderMst.wrkID} = '" & mWOID & "'" For i = 0 To cr.Database.Tables.Count - 1 cr.Database.Tables(i).ApplyLogOnInfo(ConInfo) Next cr.SetDataSource(DS.Tables(0, 1)) crViewer.DisplayGroupTree = False crViewer.ShowGroupTreeButton = False crViewer.ReportSource = cr Catch ex As Exception Messagebox.Show(ex.Message) End Try End Sub
By the way, this code runs cleanly completely thru from the time the procedure is called until it exits.
Thanks,




Reply With Quote