Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Thursday, March 22, 2012

Crystal Reports error

Hello: :wave:
I have a C# project which contains a web form, which has a button calling a web page containing a crystalreportviewer, which contains a CrystalReport report; when I call this page through Response.Redirect("WebForm2.aspx"); WebForm2 is not opening, instead it is sending me an error: [Null]Reference Exception: Reference to object does not stated as object's instance.]
Somebody know what is reason of this error?
I'll thank you for your help.
A.L.Hello.
At last I found the way to solve it. Something wrong was in it.
I reinstalled Visual Studio .NET.
Regards.
A.L.
:wave:

Tuesday, March 20, 2012

Crystal reports [vb6]

I need some help with Crystal - I am new to the package and I'm battling with the VB integration

My current .vbp project has a form with the following code

General Declaration

Public CrxApplication As New CRAXDRT.Application
Public CrxReport As New CRAXDRT.Report

Then in my code (I'm showing a menu - depending what the user chooses...)

Select Case Index
Case 0
openfile.Filter = "Reports (*.rpt)|*.rpt"
openfile.ShowOpen
If openfile.FileName <> "" Then
Set CrxReport = CrxApplication.OpenReport(openfile.FileName, 0)
CrxReport.Database.LogOnServer "p2sodbc.dll", dsn, dbName, UserName, UserPassword
'? "p2ssql.dll" vir sql?
CRViewer1.ReportSource = CrxReport
CRViewer1.ViewReport
End If
Case 2
----------
CrxReport.PrinterSetup Me.hWnd (HERE the error occurs)
----------
Case 3
CRViewer1.PrintReport

Case 5
End

End Select


when CASE = 2 my program errors - 'Method 'printersetup' of object 'Ireport' failed

what does this mean? I am not using an "Ireport' somewhere

Pse help

Thanks!Not sure about the IReport.

But, you havent SET CrxReport under "2"...

shouldnt that have been done ?|||IReport is the interface|||Dim crystal As New CRAXDRT.Application
Dim report As New CRAXDRT.report
Dim ms As String
Private Sub Command1_Click()
ms = "1"
Set report = crystal.OpenReport("C:\test\Report\test.rpt")
report.Database.LogOnServer "p2sodbc.dll", "test", "test", "test", "test"

CRViewer91.ReportSource = report
CRViewer91.ViewReport
Do While CRViewer91.IsBusy
DoEvents
Loop
CRViewer91.Zoom 77

End Sub
Private Sub CmdPrinterSetting_Click()
If ms = "" Then
MsgBox "ReportSource is Nothing"
Exit Sub
Else

report.PrinterSetup Me.hWnd
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
ms = ""
Set crystal = Nothing
Set report = Nothing
End Sub

pls check

if CRViewer91.ReportSource is nothing
this error will be found

Monday, March 19, 2012

Crystal Reports

Hello out there,

I have a problem with crystal reports. I have added the report from VB6. This is the code in the Form Section

Visual Basic 6 Code:
------------
Dim Report As New CrystalReport1

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault

strSelectString = "{M_Receipt.PayMtd} = 'Credit Card' "

CrystalReport1.RecordSelectionFormula = strSelectString

End Sub
------------
end of Visual Basic 6 Code

This code still gives me all the records from the database. I connected to the DSN in the Crytal report itself using Database-->Set Location, then pointing to my DSN.(Connecting to an Access Database)

How can i resolve this so that only the records i want are displayed.

ThanksMillions in advance[ Moved to Crytal Report forum]|||Add parameters in the said crystal report, use these parameters in the Report Selection option.

Pass values to the crystal report from the VB script.

Sample way of passing parameters is as below :

For eg., the parameter name is vPayMtd.

CrystalReport1.Parameterfields(0) = 'vPayMtd;' & 'Credit Card' & ';true'

Here if want to pass a value in the condition of comparision
of vPayMtd = 'Credit Card', above notation can be used.

Try with this.|||Hi Friends,

m new to crystal reports and facing some problems regarding the same

i made one rpt in crystal rpts.
and now want to call it in vb 6

the coding which i have used is as follows.

frmemp.crystalreport1.connect = "dsn,uid,pwd"
frmemp.crystalreport1.reportfilename = "c:\programe files\..\empdtl.rpt"
frmemp.crystalreport1.action = 1

m i missing out something,

please guide me for this query.

regards,
kalpana

Crystal Reports

hai

how to get the textbox value from a form to the crystalreport.I have two textbox

form1-------> TextBox1

crystal report ---->TextBox2

i want to assign the values of the textbox2 in the crystal report by the value of the Textbox1.Any body know the solution plz help me.you try using parameter field in crystal report and you can pass value to it from form.|||hai,

Thank you very much for ur information.If ur having any example code please sent it to me.|||Read about parameters in CR help file

Crystal Report.passing para and fatch record in Crystal Report

Dear Sir,

I m newer to crystal Report.i become crystal Report.now i want ,

I become Vb form which have ID and Date ,
i want selct id and date from vb form and searching that matching records in table and display in crystal report ..


how can i do this...

plz...help me..it's urgent...


Thanx in Advance

Sabina Maniar
U.A.EYou can either use Parameters or Selection formula
Refer http://www.dev-archive.com/forum/showthread.php?t=395587

Crystal Report Viewer "Error, Not Implemented"

I have reports to display using Crystal Report 10.

To print it, the user has to push a button on vb which open a vb form called
CrViewer.

Since the source of the CR could be in a different location, im trying to make it load a db from a path that is saved into the db.

Private Sub Form_Load()
Dim lsSql As String
Dim lstr As String
Dim lDateDebut As Date
Dim lDateFin As Date
Dim lcFormulas As String
Dim liListcount As Integer
Dim lsPathBD As String
Dim lvRapportId As Variant
Dim llPeriodePaye As Long

Dim lCrxApplication As CRAXDRT.application
Dim lRapportCrystal As CRAXDRT.Report
Dim lCrxDatabaseField As CRAXDRT.DatabaseFieldDefinition
Dim i As Long

Set lCrxApplication = New CRAXDRT.application

Set lRapportCrystal = lCrxApplication.OpenReport(ObtenirRepertoireRapport() & "RapportAdmRemboursementCumul.rpt", crOpenReportByTempCopy) ' OptenirRepertoirRapport() is a function that return the path to the report directory that is saved in the database.
' Finds the path from the registry...
lsPathBD = GetSetting("GTS", "Demarrage", "RepertoireBD", "")
lRapportCrystal.DiscardSavedData

For i = 1 To lRapportCrystal.Database.Tables.Count
lRapportCrystal.Database.Tables(i).Location = lsPathBD
Next i


frmCRViewer.CRViewer.ReportSource = lRapportCrystal
CRViewer.ViewReport
Set frmCRViewer = Nothing

Set lCrxDatabaseField = Nothing
Set lRapportCrystal = Nothing
Set lCrxApplication = Nothing
End Sub

The problem is encounter when the Crystal Report is opening. it Open but then I get the Error "Erreur, Non Implment" with "Crystal Report Viewer" as title for the errmsg.

Im using Visual Basic 6.0 (SP6)
Windows XP Home, French (SP2)
Crystal Report 10.0.5.1025 Dev. Full, French

Any Help would be Appreciated.the properties of the Database are:

OLE DB (ADO)
Microsoft.Jet.OLEDB.4.0
C:\Projet\Simoneau\DB\DB.mdb

Access
1033
-6
Admin

When using the Crystal Report Tool, no error are popping up but when calling the command
CRViewer.ViewReport The Error pop's up.

I have download a sample from Planet Source

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=59818&lngWId=1

It also work fine using the Access/Excel(DAO) database source but if I change it to Microsoft.Jet.OLEDB.4.0 it keep giving me that same error.

Is there anyway to go around this error msg and display my report using Microsoft.Jet or do i have to use Access/Excel DAO absolutely ?

Sunday, March 11, 2012

Crystal Report Problem

Please guide me..
I have a form which has a button on it. when clicked it opens up a Crystal Report, designed in Crytsal Report 10.0.
The source of the data for the report is an .xsd file, which basically resides in my C:\INETPUB\WWWROOT\<app name>\ directory.
The application runs fine on my machine.
when the whole of the code is deployed to some other machine and executed, the report again looks for the .xsd file in the
C:\INETPUB\WWWROOT\<app name>\ which is different this time, and thus results in an error.
How can this be solved...The data source obviously has to be available to wherever you're trying to run the report from. I'd suggest putting the file in a shared place on the network so that all machines running the report can access it using the same address.

Thursday, March 8, 2012

Crystal Report Error

Hi,

After putting the crystalreportviewer into a form in visual studio .Net, I have choosen the DataBindings properties and type the path of the report source inside. The display in the design window of visual studio can see the report output but when I press F5 to run the debug, the browser came out the following error messge. Does anyone help to solve it?
Thank you.

Server Error in '/WebApplication2' Application.
------------------------

Load report failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Load report failed.

Source Error:

Line 12: <body MS_POSITIONING="GridLayout">
Line 13: <form id="Form1" method="post" runat="server">
Line 14: <CR:CrystalReportViewer id=CrystalReportViewer1 style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 8px" runat="server" Width="936px" Height="1044px" ReportSource='<%# "C:\Program Files\Microsoft Visual Studio .NET 2003\Crystal Reports\Samples\Reports\General Business\World Sales Report.rpt" %>' SelectionFormula="{Customer.h~~Z}>0">
Line 15: </CR:CrystalReportViewer>
Line 16: </form>


Source File: c:\inetpub\wwwroot\WebApplication2\WebForm1.aspx Line: 14

Stack Trace:

[LoadSaveReportException: Load report failed.]
CrystalDecisions.Web.ReportAgent.h()
CrystalDecisions.Web.ReportAgentBase.set_ReportSource(Object value)
CrystalDecisions.Web.ReportAgent.set_ReportSource(Object value)
CrystalDecisions.Web.CrystalReportViewerBase.set_ReportSource(Object value)
ASP.WebForm1_aspx.__DataBindCrystalReportViewer1(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebApplication2\WebForm1.aspx:14
System.Web.UI.Control.OnDataBinding(EventArgs e)
System.Web.UI.Control.DataBind()
System.Web.UI.Control.DataBind()
System.Web.UI.Control.DataBind()
WebApplication2.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebApplication2\WebForm1.aspx.vb:26
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()



------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032If your application is on Windows Server 2003, then try giving 'Read & Execute' authority to the "Network Service" account on your 'Windows\Temp' folder.

If you are using Windows 2000/Xp, then browse to your Documents and Settings folder. There you will find a folder by the name same as your machine name. Go into that folder and assign 'Read & Execute' authority to the 'ASPNET\Local Settings\Temp' folder.
If this doesnt work then try assigning full authority to the above specified folders.

Remeber that this solution will work if your rpts build action is 'Embedded Resource'. I am not sure about the other build actions.

Hope this helps!

Regards!|||i have the same problem
i allready try to change the security permission but it didn't effect

Crystal Report (using stored procedures - parameter passing)

i have created a crystal report using a stored procedure. in the web form im passing a parameter thru a textbox. but that value is not passing properly.

Dim myCMD As New SqlCommand("select_all_infor", myConn)
myCMD.CommandType = CommandType.StoredProcedure
Dim parr As New SqlClient.SqlParameter("@.Pid", SqlDbType.Int)
parr.Direction = ParameterDirection.Input
parr.Value = TextBox1.Text
myCommand.Parameters.Add(parr)
myCommand.Parameters.Add("@.Pid", TextBox1.Text)

Dim myDA As New SqlDataAdapter
myDA.SelectCommand = myCMD

Dim myDS As New myDS
myDA.Fill(myDS)

Dim myRPT As New fromSP_REPORT

myRPT.SetDataSource(myDS)

CrystalReportViewer1.ReportSource = myRPT

this is what i've written. Im not sure about connecting to a dataset. Pls correct me.

it's giving this error:

Procedure 'select_all_infor' expects parameter '@.Pid', which was not supplied.try to use this.

crReportDocument.SetParameterValue(0,(object) "first parameter");
crReportDocument.SetParameterValue(1,(object) "second parameter");

Wednesday, March 7, 2012

Crystal Report - How to add a page break?

Hi! I use Crystal Report 8 and I've created like an Invoicing Form, I need four copies of that form changing only the title for example: One saying "Original", second saying "Duplicated", etc...

I think to create the same page four times but I don't know how to add a page break as I need the same header, same body and same foot page than the first one...

Thank you for your help....I think you need to write a query like

Select * from TableName
Union All
Select * from TableName
Union All
Select * from TableName
Union All
Select * from TableName

Design the report using that query
Goto Section Expert and in the "New Page After" option, click the button labelled x-2 and write this code

If RecodNumber mod 20 = 0 then True|||Madhi,

Thank you.. but an error message appears saying "A number, currency amount, boolean, date, time, date-time, or string is expected here." I've tried to click "Page Break After" in Report Footer's Section Expert but the option is not available so I've click on the Group Footer's Section Expert...

Thank you again for your help|||Where did you get that error?|||Madhi,
Thank you again... That error occurs when I click on the Accept button on the Section Expert. I press the "x-2" button to add the formula that you've sent to me yesterday...

Regards, Guada

crystal Report

hi All,

i m using Vb 6.0,M.Access and crystal report 9

i have one form in vb which have id and date field,
i want to select values from that vb form and seaching records in table in Access and display record in crystal report....

plz..help ma...it's urgent..

Thanx in Adavance

Regards..

Sabina Maniar

U.A.epass parameters to crystal report , then use those parameter in report query or in record selection formula.|||Hi..

Thankx to reply

i have already pased a para to crystal report ,

but i dont know how to pass CR para in vb in crystal viewer...

plz...if u have any related topics then plz..plz...reply me..

thanx again

Regards,

Sabina Maniar
U.A.E|||Set Report = crystal.OpenReport(App.Path & "\report1.rpt")

Report.DiscardSavedData
Report.Database.SetDataSource rs
Report.ParameterFields(1).AddCurrentValue ("aaa")

You can use this method to set parameters..

Regards,
Ahmed

Crystal 8.5 Page Length less than 4"

Hi!

I have a VB 6.0/CR 8.5 official receipt printing on a form that is 8.5 x 3.5. It was running perfectly under Windows 98 but when I have upgrade to Windows XP I can no longer access withing CR 8.5 forms that are less than 4 inches. Any idea how can I resolve this issue.

Thanks.

rclazarito[ Thread moved to Crystal Report ]

Friday, February 24, 2012

Crosstab result

Hi there,

I'm using sql2005. I've got a table in tabular form and I need to convert it to crosstab format. I've tried to use pivot operator but i can't get the result i want. Because pivot operator needs to aggregate a field but what i need is Dim values as column names and DimCode as values within those columns as it is, no aggregations.

For example : This is tabular table.

Dim DimCode JrnlEntry GLDistId TrxDate GLPostDT TrxType AccountIndex DebitAmt CreditAmt Amount 4 2 54222 1 25/05/2007 25/05/2007 1 44256 617 0 617 4 11991 54222 1 25/05/2007 25/05/2007 1 44256 617 0 617 5 7 54222 1 25/05/2007 25/05/2007 1 44256 617 0 617 5 5 54222 1 25/05/2007 25/05/2007 1 44256 617 0 617 4 1 54225 1 31/05/2007 31/05/2007 1 44256 600 0 600 5 5 54225 1 31/05/2007 31/05/2007 1 44256 600 0 600 4 12821 54225 2 31/05/2007 31/05/2007 1 44256 400 0 400 5 4 54225 2 31/05/2007 31/05/2007 1 44256 400 0 400 4 3 54227 3 31/05/2007 31/05/2007 1 44256 0 500 -500 5 8 54227 3 31/05/2007 31/05/2007 1 44256 0 500 -500

And i want the end result as under..

jrnentry aaGLDistID TRXDATE GLPOSTDT aaTRXType Dim1 Dim2 Dim3 Dim4 Dim5 Dim6 Dim7 Dim8 Dim9 Dim10 ACTINDX DEBITAMT CRDTAMNT Amount 54222 1 25/05/2007 25/05/2007 1 0 0 0 2 7 0 0 0 0 0 44256 617 0 617 54222 1 25/05/2007 25/05/2007 1 0 0 0 11991 5 0 0 0 0 0 44256 617 0 617 54225 1 31/05/2007 31/05/2007 1 0 0 0 1 5 0 0 0 0 0 44256 600 0 600 54225 2 31/05/2007 31/05/2007 1 0 0 0 12821 4 0 0 0 0 0 44256 400 0 400 54227 3 31/05/2007 31/05/2007 1 0 0 0 3 8 0 0 0 0 0 44256 0 500 -500

Your help will much appreciated.

There is an excellent article about PIVOT by Peter Larsson.

Follow the link :

Pivot table for Microsoft SQL Server

Thanks

Naras.

|||

For quite a few examples of using PIVOT, do a search on this Forum for the keyword 'Pivot'. Amazing how often this question is asked, and how often folks don't seem to bother looking in the archives to find their answer.

|||

Thanks Naras,

I'm not looking for help in Pivot functionality of sql2005 as it won't be usefull for me. If you look at the first table, i want the first column Dim to be used for the new columns i.e. Dim1, Dim2, Dim3 will be columns in the crosstab result but then i want DimCode to appear under respective columns without any aggregations. In pivot you've to use aggregate function. Also in crosstab result if look at the record with jrnentry 54222, there are two lines with the same aaGLDistId i.e. i don't want to aggregate values within dim1, dim2 etc.

Thanks

Vivek

|||

Vivek,

You are wrong. You can achive it using the PIVOT Operator. See the below query..

Code Snippet

Create Table #data (

[Dim] int ,

[DimCode] int ,

[JrnlEntry] int ,

[GLDistId] int ,

[TrxDate] datetime ,

[GLPostDT] datetime ,

[TrxType] int ,

[AccountIndex] int ,

[DebitAmt] int ,

[CreditAmt] int ,

[Amount] int

);

Set Dateformat DMY

Insert Into #data Values('4','2','54222','1','25/05/2007','25/05/2007','1','44256','617','0','617');

Insert Into #data Values('4','11991','54222','1','25/05/2007','25/05/2007','1','44256','617','0','617');

Insert Into #data Values('5','7','54222','1','25/05/2007','25/05/2007','1','44256','617','0','617');

Insert Into #data Values('5','5','54222','1','25/05/2007','25/05/2007','1','44256','617','0','617');

Insert Into #data Values('4','1','54225','1','31/05/2007','31/05/2007','1','44256','600','0','600');

Insert Into #data Values('5','5','54225','1','31/05/2007','31/05/2007','1','44256','600','0','600');

Insert Into #data Values('4','12821','54225','2','31/05/2007','31/05/2007','1','44256','400','0','400');

Insert Into #data Values('5','4','54225','2','31/05/2007','31/05/2007','1','44256','400','0','400');

Insert Into #data Values('4','3','54227','3','31/05/2007','31/05/2007','1','44256','0','500','-500');

Insert Into #data Values('5','8','54227','3','31/05/2007','31/05/2007','1','44256','0','500','-500');

Select

[JrnlEntry]

,[GLDistId]

,[TrxDate]

,[GLPostDT]

,[TrxType]

,Isnull([1],0) Dim1

,Isnull([2],0) Dim2

,Isnull([3],0) Dim3

,Isnull([4],0) Dim4

,Isnull([5],0) Dim5

,Isnull([6],0) Dim6

,Isnull([7],0) Dim7

,Isnull([8],0) Dim8

,Isnull([9],0) Dim9

,Isnull([10],0) Dim10

,[AccountIndex]

,[DebitAmt]

,[CreditAmt]

,[Amount] From

(

Select

[Dim]

,[DimCode]

,[GLDistId]

,[JrnlEntry]

,[TrxDate]

,[GLPostDT]

,[TrxType]

,[AccountIndex]

,[DebitAmt]

,[CreditAmt]

,[Amount]

,Row_Number() Over (Partition By [Dim],[GLDistId],[JrnlEntry] Order By [Dim],[GLDistId],[JrnlEntry]) RowId

From

#data

) as Data

Pivot

(

Max([DimCode])

For [Dim] in

(

[1],[2],[3],[4],[5],[6],[7],[8],[9],[10]

)

) As PVT

|||

Thanks Manivannan, much appreciated. Its returning correct result. I almost spent the whole day on this yesterday with frustration.

Regards,

Vivek

Crosstab queries in MS SQL

Am I right in coming to the conclusion that there is no built in method for
creating crosstab queries in MS SQL 2000? I have form the reference under
"Pivot" in SQL books that demonstrates how to build your own but it doesn't
account for scenarios where I don't know how many column headings I require.
I have mocked up this SQL text in MS Access which shows what I want but I
can't seem to generate such a result set in SQL.
Any Ideas?
Mr. Smith
SQL Text:............
TRANSFORM Sum(testoutput.JobCount) AS SumOfJobCount
SELECT testoutput.Client, testoutput.ContractName,
testoutput.OfficeLocationID, [Request Month] & ' ' & [Request Year] AS ReqMt
h
FROM testoutput
GROUP BY testoutput.Client, testoutput.ContractName,
testoutput.OfficeLocationID, [Request Month] & ' ' & [Request Year]
PIVOT testoutput.TradeCategory;That's correct. To pivot in SQL 2000 you need to know how many columns
there will be because you essentially have to have a case statement for
each column. SQL 2005 is in that respect because they've
introduced the PIVOT & UNPIVOT keywords (part of the SELECT clause
syntax) to make the syntax native to the T-SQL language used in Yukon.
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* mailto:mike.hodgson@.mallesons.nospam.com |* W* http://www.mallesons.com
Mr. Smith wrote:

> Am I right in coming to the conclusion that there is no built in method fo
r
>creating crosstab queries in MS SQL 2000? I have form the reference under
>"Pivot" in SQL books that demonstrates how to build your own but it doesn't
>account for scenarios where I don't know how many column headings I require
.
>I have mocked up this SQL text in MS Access which shows what I want but I
>can't seem to generate such a result set in SQL.
>Any Ideas?
>Mr. Smith
>SQL Text:............
>TRANSFORM Sum(testoutput.JobCount) AS SumOfJobCount
>SELECT testoutput.Client, testoutput.ContractName,
>testoutput.OfficeLocationID, [Request Month] & ' ' & [Request Year] AS ReqM
th
>FROM testoutput
>GROUP BY testoutput.Client, testoutput.ContractName,
>testoutput.OfficeLocationID, [Request Month] & ' ' & [Request Year]
>PIVOT testoutput.TradeCategory;
>
>|||Mr. Smith meet RAC:)
www.rac4sql.net