cancel
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

Don

former_member183750
Active Contributor
0 Kudos

As for code samples, see KB [1553921 - Is there a utility that would help in writing database logon code?|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333533353333333933323331%7D.do].

And while you're at it, see [this|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10b840c0-623f-2b10-03b5-9d1913866b32]

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 vbnet_win_dbengine.zip available from [here|http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples].

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.

Thanks.

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.