Hi all
Ok i have done the following...
1. Right clicked and selected add new item
2. Selected crystal reports option and left the name the same.
3. Used the reporting wizard to set up the report.
4. Expanded the ODBC option, select SQL Server option and click next.
5. Next page tells me that the Server is "SQL Server", and the User ID is "Administrator", while the password field and database dropdown list are blank. I also have the option of checking a checkbox which indocates whether it is a trusted connection or not.
6. In this case i fill up the boxeswith the following data Server = "SQL Server", User ID = "Administrator", Password = "********" and i tick the trusted connection option and finally the database is set to the "Northwind" database. I the click Finish.
7. I then expand the Northwind option that has appeared under the SQL Server option in the initial screen, i continue to expand untill i have located the tables option which i also expand and select the employees table and then click the insert button.
8. I then click next and select the first three columns, EmployeeID, FirstName, LastName. I then click next and go to the groupby option where i select the EmployeeID field.
9. I then click finish.
10. Next i take place the following section of code and place it behind a button...
Imports System.Web.UI.WebControls
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Dim oRpt As New CrystalReport1 name of my report
Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
Dim myDiskFilesDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
Dim myExportFile As String
myExportFile = "C:\temp\PDF " & Session.SessionID.ToString & ".pdf"
myExportFile = "C:\temp\PDF rptCrystalTest.pdf"
myDiskFilesDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
myDiskFilesDestinationOptions.DiskFileName = myExportFile
myExportOptions = oRpt.ExportOptions
With myExportOptions
.DestinationOptions = myDiskFilesDestinationOptions
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat
End With
oRpt.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(myExportFile)
Response.Flush()
Response.Close()
System.IO.File.Delete(myExportFile)
11. When the code runs, it should take the crystal report that i designed and put into pdf format in the location stecified.
The problem is that when i run the project and click the button, i get a message telling me that... Server Error, ...Logon failed.
Can anyone suggest where i am going wrong. In relation to the user name and password, i have tried the above proceedure without username and password, and with username but no password, to same some (but still the same problem). I dont know why .net net want the username to be "Administrator" as the database does not have a username or password.
Mike55