|
-
Sep 6th, 2010, 06:35 PM
#1
Thread Starter
PowerPoster
Trying to access Crystal Report thru VB.Net code?
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,
Last edited by blakemckenna; Sep 6th, 2010 at 06:47 PM.
Blake
-
Sep 6th, 2010, 10:13 PM
#2
Re: Trying to access Crystal Report thru VB.Net code?
Hi.Being ages with using Crystal reports but is cnn a global value?Check to see it has the correct connections.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Sep 6th, 2010, 10:42 PM
#3
Thread Starter
PowerPoster
Re: Trying to access Crystal Report thru VB.Net code?
Yes..."cnn" is a global variable...
-
Sep 7th, 2010, 08:43 AM
#4
Re: Trying to access Crystal Report thru VB.Net code?
Hey.
Again out of the top of my mind, and sorry if it's wrong.
I remember a variable you set on Crystal that will deactivate the logon screen, or something like that.Sorry if i'm wrong but i see noone helped you so...
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Sep 7th, 2010, 12:17 PM
#5
Thread Starter
PowerPoster
Re: Trying to access Crystal Report thru VB.Net code?
If there is a variable or property within CR, I have no idea what it could be.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|