hi,
i'm beginner in c#.net & currently working for a windows application.i have problem to customize the report in the crystal report and also everytime i run the code it asks for connection info which i had assigned during design time.Any help in this regard is appreciable.
thanks

Hi Deepas,

Just like you i have to call crystal reports from C#.NET from time to time. I'm not the great expert myself but I'll share my knowledge as much as i can:

The way you describe your problem, it seems to me the problem is situated in the database connection of the crystal report. Our crystal reports use ODBC-connections with windows-authentication (to SQL Server 2005). This way we never get dialog boxes to enter usernames or passwords.

So if you open the datasource location-screen, you can add a new ODBC (RDO) connection. In the ODBC(RDO) screen you select the needed ODBC-connection (see attachment 1). In the next screen you select the database and check "trusted connection" (see attachment 2).

With this type of connection you should be able to open your reports without any trouble. By the way, I have the dutch version of crystal reports installed on my computer so I don't know exactly some names and screen titles in the english version.

Hope this is helpful

hi EastStreetEagle
While making connection with ODBC,it didn't showed sql database.so how can i make connection with that,attachments are also not clear.In your attachement you've so many options to select which in my case is only 4(No sql) in the option.Kindly advise me

Hi again Deepas,

Obviously I skipped a few steps.

When you make an ODBC-connection, you determine to which SQL Server it points to. So when you select the ODBC-connection in your crystal report afterwards, you actually also select your SQL Server. If you don't know how to make an ODBC-connection, look at the attachment of this post. Each image is a printscreen of every screen, the textfile give extra comment to each image (I couldn't upload it in a word-file so I had to do it this way). It takes about 2 to 3 minutes.

Keep in mind that when you install your application on multiple computer, you have to make the same ODBC-connection on each computer.

The reason why I had so many options in the listbox on the printscreen on my previous post is that I had to make an ODBC-connection for multiple customers each. The moment you make an ODBC-connection on your computer, that same connection will also be available.

Hope you get any further

EastStreetEagle

You can pass connection information dynamicall y to the crystal reports with the help of ConnectionInfo class.

ConnectionInfo crConnectionInfo = new ConnectionInfo();

crConnectionInfo.ServerName = "YOUR SERVER NAME";
crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
crConnectionInfo.Password = "YOUR DATABASE PASSWORD";

Then it wont ask the information anymore.

full source code

http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-dynamic-login.htm

jr.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.