crystal report library for classic asp - crystal-reports

is there a library available for classic asp. I want to create a pdf file from rpt file in classic asp. i dont want to install crystal reports. is there a way?
-Vivek

You can use only the Crystal Reports redistributable DLLs to open a report file and generate a PDF with it.
I've never tried to open the Crystal Reports library directly from ASP, but should be no problem (or you can create a COM Dll in VB6 if you can)
Some code I have in a VB6 DLL using Crystal Reports 9:
Private Sub Export(ReportFile as string)
Dim crxReport As Report
Set crxReport = Prepare(ReportFile )
crxReport.ExportOptions.FormatType = crEFTPortableDocFormat
crxReport.ExportOptions.DestinationType = crEDTDiskFile
crxReport.ExportOptions.DiskFileName = "C:\export\export.pdf"
crxReport.Export (False)
end sub
Private Function Prepare(ReportFile as string) As Report
Dim CRapp As CRAXDRT.Application
Set CRapp = New CRAXDRT.Application
Dim crxReport As Report
Dim aDatabaseObject As Database
Dim aDatabaseTableObject As CRAXDRT.DatabaseTable
Dim objConn As ConnectionProperty
Set CRapp = New CRAXDRT.Application
CRapp.SetLicenseKeycode ("XXXXXXXXXXXXXXXXXXXXXXXX")
Set crxReport = CRapp.OpenReport(ReportFile)
Set aDatabaseObject = crxReport.Database
Set cnn = New ADODB.Connection
cnn.ConnectionString = MyConnectionString()
Set aDatabaseObject = crxReport.Database
For Each aDatabaseTableObject In aDatabaseObject.Tables
Dim objCPProperties As CRAXDRT.ConnectionProperties
aDatabaseTableObject.DllName = "crdb_ado.dll"
Set objCPProperties = aDatabaseTableObject.ConnectionProperties
objCPProperties.DeleteAll
objCPProperties.Add "Provider", "SQLOLEDB"
objCPProperties.Add "Data Source", cnn.Properties.Item("Data Source").Value
objCPProperties.Add "Initial Catalog", cnn.Properties.Item("Initial Catalog").Value
objCPProperties.Add "User ID", cnn.Properties.Item("User ID").Value
objCPProperties.Add "Password", cnn.Properties.Item("Password").Value
aDatabaseTableObject.Location = aDatabaseTableObject.Name
Next
Set Prepare = crxReport
End Function

Related

GLS ShipIt SOAP with Visual Studio

does anyone have experience with the SOAP interface of GLS ShipIt?
I integrated these into Visual Studio VB .net, but after setting the credentials and ContactID, the "CreateParcels" function always reports the error "unauthorized".
Dim glscreateparcel As new GLSShipIT.ShipmentProcessingService
glscreateparcel.PreAuthenticate = True
glscreateparcel.Url = "https://shipit-wbm-test01.gls-group.eu:8443/backend/ShipmentProcessingService/ShipmentProcessingPortType?wsdl"
glscreateparcel.Credentials = New System.Net.NetworkCredential(benutzer, kennwort)
glscreateparcel.InitializeLifetimeService()
Dim glsshipmentrequestdata As New GLS.GLSShipIT.ShipmentRequestData
'some code for shipmentrequestdata details
glsshipmentrequestdata.Shipment.Shipper.ContactID = ContactID
Dim response As GLSShipIT.CreateParcelsResponse = glscreateparcel.createParcels(glsshipmentrequestdata)
the Variables for ContactID, benutzer and kennwort were previously set.
best regards

Access 2007 to Word, Outlook for 2-step Mail Merge

My VBA does the email merge wonderfully ... except, I have to click on "allow" - from Outlook - twice, for each email generated. Is there a way to programatically get around this?
I am running Windows 7 Enterprise, SP1. MS Office 2007. Computer is tightly locked down. HTML format e-mail not supported - only plain text. I do not have local admin rights. I am not able to install additional add-ins or third party software, as I've found suggested numerous times.
Here is my working VBA:
Private Sub Send_Email_Merge()
Dim sDBPath As String
'Word variables
Dim oWD As Word.Application
Dim oDoc As Word.Document
Dim RecCount As Long
'Sanity check on how many e-mails to be sent
RecCount = DLookup("[Email Count]", "qry_EmailMerge_Count")
Debug.Print RecCount
Set oWD = CreateObject("Word.Application")
oWD.Visible = True
Set oDoc = oWD.Documents.Open("C:\MyTemp\MyDocs\MyEmailMerge.docx")
With oDoc.MailMerge
.MainDocumentType = wdFormLetters
sDBPath = "C:\MyTemp\MydBs\My_Engine.accdb"
.OpenDataSource Name:=sDBPath, _
SQLStatement:="SELECT * FROM [qry_E Mail Merge]"
End With
oWD.Activate
oWD.Documents.Parent.Visible = True
oWD.Application.WindowState = 1
oWD.ActiveWindow.WindowState = 1
With oDoc.MailMerge
.Destination = wdSendToEmail
.MailAddressFieldName = "Email Address"
.MailSubject = "Your Action Required"
.MailFormat = wdMailFormatPlainText
.Execute
End With
oWD.Activate
oWD.Documents.Parent.Visible = True
oWD.Application.WindowState = 1
oWD.ActiveWindow.WindowState = 1
oWD.ActiveDocument.Close
oWD.Quit
Set oWD = Nothing
Set oDoc = Nothing
End Sub
Any help is appreciated.
You can automate directly from Access. See How to automate Outlook from another program for more information. It describes all the required steps for automating Outlook from another applications.

Create User Defined Type In SMO

How Create User Defined Type (ex: Point(X int,Y int) With SMO?
I Am Use VB.NET (Or C#.NET) And Want Use SMO For Create?
I know must use "UserDefinedType" in SMO but i don't know How?!
Thanks.
By using following code sample you can create UserDefinedType using SMO:
Dim oServer As Microsoft.SqlServer.Management.Smo.Server
Dim oSMOServer As Microsoft.SqlServer.Management.Smo.Server
Dim oSMODatabase As Microsoft.SqlServer.Management.Smo.Database
Dim sUDT As String = "udt_RecordID"
Try
oServer = New Microsoft.SqlServer.Management.Smo.Server()
''Set ServerName
oServer.ConnectionContext.ServerInstance = pServerInstanceName
''Set is Windows Authentication
oServer.ConnectionContext.LoginSecure = pIsWinAuth
''Set Server UserName & Password, If not Windows Authentication
If pIsWinAuth = False Then
oServer.ConnectionContext.Login = pUsername
oServer.ConnectionContext.Password = pPassword
End If
Dim oUDTs = oSMOServer.Databases(pDatabaseName).UserDefinedTableTypes
''Add UserDefinedType if not exist
If Not oUDTs.Contains(sUDT) Then
oSMODatabase = oSMOServer.Databases(pDatabaseName)
Dim udtt As UserDefinedTableType
udtt = New UserDefinedTableType(oSMODatabase, sUDT)
''Add necessary columns
udtt.Columns.Add(New Microsoft.SqlServer.Management.Smo.Column(udtt, "RecordID", DataType.NVarChar(50)))
''Create UserDefinedType
udtt.Create()
End If
Catch ex As Exception
''Handle Exception
End Try
Feel free to ask if required.

Crystal Reports Runtime & Redistributable

Is there a difference between these two things. I am trying to move some reports from a local server to a dev server and I know that we have installed the redist on the dev server, but am still having problems getting the report to run. Is the runtime separate I come accross different sites mentioning both things but havent been able to tell if they are talking about the same thing
*Edit - posting code to see if as dotjoe suggested I have incorrectly labled my report path. the database connection is returned from a method to a string array reportString so that is what that array is.
<CR:CrystalReportViewer ID="CrystalReportViewer2" runat="server"
AutoDataBind="True" Height="50px" Width="350px" ReuseParameterValuesOnRefresh="True" ToolbarImagesFolderUrl="~/images/reportViwerImages"/>
ConnectionInfo myConnectionInfo = new ConnectionInfo();
myConnectionInfo.ServerName = reportString[1];
myConnectionInfo.DatabaseName = reportString[0];
myConnectionInfo.UserID = reportString[2];
myConnectionInfo.Password = reportString[3];
string ReportPath = Server.MapPath("../../mdReports/CrystalReport.rpt");
CrystalReportViewer2.ReportSource = ReportPath;
ParameterField field1 = new ParameterField();
ParameterDiscreteValue val1 = new ParameterDiscreteValue();
val1.Value = hiddenFieldReportNumber.ToString();
field1.CurrentValues.Add(val1);
SetDBLogonForReport(myConnectionInfo);
private void SetDBLogonForReport(ConnectionInfo myConnectionInfo)
{
TableLogOnInfos myTableLogOnInfos = CrystalReportViewer2.LogOnInfo;
foreach (TableLogOnInfo myTableLogOnInfo in myTableLogOnInfos)
{
myTableLogOnInfo.ConnectionInfo = myConnectionInfo;
}
}
you have not load the report from the given Path.
Please see below link

How to limit export formats in crystal reports

For Crystal reports for visual studio .net 2005, you can export the report
to various file format such as pdf, excel, word, rpt etc. If I just want to
limit the user see only excel and word format and set the default file
format to excel, is there a way to do it? Sometimes too many choose is
not good, is it?
Using CRVS2010 , you can remove unwanted export Option.
A new feature of CRVS2010 is the ability to modify the available export formats from the viewer export button. The following C# sample code demonstrates how to set the CrystalReportViewer to export only to PDF and Excel file formats:
int exportFormatFlags = (int)(CrystalDecisions.Shared.ViewerExportFormats.PdfFormat | CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat);
CrystalReportViewer1.AllowedExportFormats = exportFormatFlags;
For More Details Please refer below link..
http://scn.sap.com/community/crystal-reports-for-visual-studio/blog/2011/01/26/export-file-formats-for-sap-crystal-reports-for-vs-2010
Try this:
Dim formats As Integer
formats = (CrystalDecisions.Shared.ViewerExportFormats.PdfFormat Or CrystalDecisions.Shared.ViewerExportFormats.XLSXFormat)
CrystalReportViewer1.AllowedExportFormats = formats
You don't mention whether you are using C# / VB.NET or Web/WinForms.
C#
I don't think this is possible. You would have to implement your own Export Button.
Something along the lines of this MSDN article
C#
// Declare variables and get the export options.
ExportOptions exportOpts = new ExportOptions();
ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions ();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = Report.ExportOptions;
// Set the excel format options.
excelFormatOpts.ExcelUseConstantColumnWidth = true;
exportOpts.ExportFormatType = ExportFormatType.Excel;
exportOpts.FormatOptions = excelFormatOpts;
// Set the disk file options and export.
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
diskOpts.DiskFileName = fileName;
exportOpts.DestinationOptions = diskOpts;
Report.Export ();
VB.NET
' Declare variables and get the export options.
Dim exportOpts As New ExportOptions()
Dim diskOpts As New DiskFileDestinationOptions()
Dim excelFormatOpts As New ExcelFormatOptions()
exportOpts = Report.ExportOptions
' Set the excel format options.
excelFormatOpts.ExcelTabHasColumnHeadings = true
exportOpts.ExportFormatType = ExportFormatType.Excel
exportOpts.FormatOptions = excelFormatOpts
' Set the export format.
exportOpts.ExportFormatType = ExportFormatType.Excel
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
' Set the disk file options.
diskOpts.DiskFileName = fileName
exportOpts.DestinationOptions = diskOpts
Report.Export()
VB.NET
You used to be able to remove certain export DLLs from the client installation. i.e remove all apart from the Excel DLLs and then it would only display the export options as Excel
To disable Crystal Report Rpt format try this :
Dim formats As Integer
formats = (CrystalDecisions.Shared.ViewerExportFormats.AllFormats Xor CrystalDecisions.Shared.ViewerExportFormats.RptFormat)
CrystalReportViewer1.AllowedExportFormats = formats
Or Short Version :
CrystalReportViewer1.AllowedExportFormats = (CrystalDecisions.Shared.ViewerExportFormats.AllFormats Xor CrystalDecisions.Shared.ViewerExportFormats.RptFormat)