Archive for June, 2011

Unable to write to output file [FileName] .pdb: Unspecified error Visual Studio

Today I had a very weird problem with visual studio 2010 SP1. Whenever I build the solution I keep getting “Unable to write to output file [FileName] .pdb: Unspecified error” for one of the projects.
I tried cleaning the solution, deleting files in the obj and bin folders and rebuilt, made sure that the files are not readonly. That didn’t help.

Figured out that there was a missing file in one of the projects. To know which file it is:

Close visual studio

Reopen the solution (DON’T build)

Check the Errors List

You should see

Error    1    Unable to open module file [FileName].vb : The system cannot find the file specified.    [FileName] [Project]

Categories: .NET, 2010, Visual Studio Tags: ,

Nhibernate with Oracle.DataAccess Configuration

I noticed yesterday in the project I am working on that Nhibernate was using the System.Data.OracleClient instead of the Oracle.DataAccess driver. To fix that I had to change the configuration in web.config (app.config for windows applications) from

<!-- Microsoft Driver -->
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>


<!-- Oracle Driver -->
<property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
Categories: NHibernate Tags:

Crystal Reports CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.

Programmatically change the datasource/database on Crystal Reports

Today I got an exception an exception when we moved the reports to the testing environment. The exception was:

Message / Message: Logon failed. Details: [Database Vendor Code: 1005 ] Logon failed. Details: [Database Vendor Code: 1005 ] Error in File MyReportName {5A28B2BB-9269-4B72-B0B9-250D37A7ED62}.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 1005 ]
Source / Source: CrystalDecisions.ReportAppServer.DataSetConversion

The requirement was to use the Pull method to populate the datasource in the report. In other words, connect the report directly to a view in the database.

I was calling the SetDataBaseLogon to pass the credentials and and the datasource to the

report.crReportDocument.SetDatabaseLogon(SqlCon.UserID, _
                          SqlCon.Password, SqlCon.DataSource, "")

With the above code I was still getting the exception. The solution was to set the connection of the DataSourceConnections collection property

'This line is necessary to replace the datasource in the report with the one
'related to the enviroment
If crReportDocument.DataSourceConnections.Count > 0 Then
   crReportDocument.DataSourceConnections(0).SetConnection(SqlCon.DataSource, _
                                             "", _
                                             SqlCon.UserID, _
End If
'This line sets the credentials for the datasource set in the Datasourceconnections.SetConnection
crReportDocument.SetDatabaseLogon(SqlCon.UserID, SqlCon.Password, SqlCon.DataSource, "")