Showing results for 
Search instead for 
Did you mean: 

Adding ServerName\InstanceName in C# at Runtime

Former Member
0 Kudos

How do you add the sql server name plus the Instance name in C#

I've tried many different ways.

strServerName = "Homer" + "\" + "Budget";

rpt.SetDatabaseLogon("xxxx", "xxxx", strServerName , strDatabase);

I've created the reports on another server and now I have to add the instance name.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Moved to .NET forum.

Test it in the Report Designer using the Set Location button and then do the same in code.

Thank you


Active Contributor
0 Kudos

As for code samples, see KB [1553921 - Is there a utility that would help in writing database logon code?|].

And while you're at it, see [this|]

That assumes you are using a full stand-alone version of CR (always a good idea to specify version of CR, Service Packs and version of .NET...)

If you are using one of the .NET bundles, see the sample app available from [here|].

Also, don't forget to use the search box at the top right corner of this web page. It will bring up KBases, blogs, wikis, articles and more. Searching these forums is not a bad idea either. Checking the developer help file for your version(?) of CR will also help.

- Ludek

Answers (2)

Answers (2)

Former Member
0 Kudos

Found out that I have to set the information for each table in the report.


Former Member
0 Kudos

I am running Crystal Reports under VS 2010.

I did update the location in the report and it ran but the problem that I am having is I want to create the report pointing to one server, but when I go to run it against a differnet server.

So how do I change where the report is ran from in code. I thought the SetDatabaseLogon would do it.

Thanks for the responses so far.