on 07-10-2008 2:03 AM
Hi everyone,
I'm having some connection problems with Crystal XI and Visual Studio ASP.NET 2003.
I created the reports in my development server, they work perfectly there. Once I run them on my production server, the following error comes up:
Failed to open the connection. Details: [Database Vendor Code: 17 ] Failed to open the connection. C:\WINDOWS\TEMP\{6837BBAA-FD8A-410F-9171-12769D3B1782}.rpt Details: [Database Vendor Code: 17 ]
I don't use a CrystalReportViewer Object, Instead, I make my ReportDocument generate a PDF output.
As I said before, everything works fine on my development env and on other servers that can see the development server (any server in my network).
The reports use an OLEDB SQL Server connection pointing to the local machine.
When I run a report on the production server, it tries to connect to the development server (however, they cannot see each other), even though I set the right connection through code at runtime.
So I changed the way to connect to the database, Instead of using OLEDB I created an ODBC connection on both environment with the same name, changed the connections on the reports to use the new connection, but I kept having the same problem.
the application gets the connection information from web.config file:
//Get the connection information from Web.Config
Hashtable htConnection = Generic.StringToHashtable(ConfigurationSettings.AppSettings["ConnectionString"]);
//Set the connection
ConnectionInfo crConnectionInfo = new ConnectionInfo ();
crConnectionInfo.ServerName = htConnection["server"].ToString();
crConnectionInfo.AllowCustomConnection = true;
crConnectionInfo.DatabaseName = htConnection["database"].ToString();
crConnectionInfo.UserID = htConnection["uid"].ToString();
crConnectionInfo.Password = htConnection["pwd"].ToString();
//linking connections to the tables
foreach(CrystalDecisions.CrystalReports.Engine.Table table in crReportDocument.Database.Tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = crConnectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
}
//Generates PDF
MemoryStream oStream; // using System.IO
oStream = (MemoryStream)crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(oStream.ToArray());
crReportDocument.Close();
crReportDocument.Dispose();
Response.End();
Can anyone help me?
Thanks
Jamal
Hello Jamal,
please check a similar case under :
http://forums.asp.net/t/997655.aspx
and try the hints given there
Falk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do the following steps:
1. Open the report in the CR XI designer.
2. Select Database -> Set Datasource Location.
3. Set Datasource Location window will appear and in the replace with section connect to the database and replace these tables with the tables in the current datasource by clicking the update button.
4. After updating close the Set Datasource Location window.
5. Go to 'Database menu' and Click 'Verify Database' and click on u2019OKu2019.
6. Preview the report and the save the report.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.