On changing connection with crystal report forms
Asked Answered
F

1

7

I am having a serious trouble trying to move my VB.Net project which uses SAP Crystal Reports to another computer (which has its own local MSSQL database). When I first made this project, the computer name on which I worked was "LUKA-LAP", and I had it set up to work with the database on that computer named "LUKA-LAP\SQLExpress". Now I want to migrate my app to another computer(let's call it target computer), so I have to rebuild it and change the computer(server) name to match another computer. However, I don't see how I can do it without installing VS on that(target) computer and recompile the whole project on it, which seems like a lot of useless work. I am trying to rebuild it from third computer(the current one I own) on which I have VS and all tools installed, and there I succeeded in making it work by adjusting the name of this computer. But I don't want to install VS on the target computer. However, when I try to manually enter the name of target computer, VS first tries to connect to its server, but of course doesn't find it(we are not on the same network atm), and refuses to remember the connection name with the target computer's name. Is there any possible way to bypass this check and just memorize the connection, so that when I run it on target computer, it just works?

Ideally, I would like to have something like Connection String from my project and use it for Crystal Report form for connection, while keeping my old commands(queries).

Frivol answered 1/2, 2017 at 12:8 Comment(3)
Where did you write your connection? In Code Behind? Is the connection you mean is Connection of Crystal Report? or Connection of your Project?Dannydannye
It's the connection set up through Database Expert in Crystal Report. I would ideally want smth like Connection String in VBFrivol
It's a bit messy, but you can do it in code. I have successfully used a slightly modified version of the code you can find over hereLesterlesya
D
3

When I want to change database, from say test to production, or vice versa, I go to Database > Set Datasource Location... From there, I select a previously created connection name, or Create a New Connection.

When moving between computers or servers, you can alternatively reference a DSN in ODBC Administrator. The connection details may differ between computers, but the DSN name you reference is the same. This avoids situations where hard coded details are different.

If you have sub-reports, you will need to update the datasource for each sub-report as well.

Update Datasource Location

Dumpcart answered 8/2, 2017 at 17:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.