I have created a Windows application where I do an SQL server connection. When I run my application on another computer, the program tells me that SQL server must be installed on that computer. My question is: Do I have to install SQL on the other computer or there is another way to make the connection to the server? I use classes to connect to server, not odbc.
You have to configure the connection so that it points to the proper server. One easy way to do so if you're using a SQLConnection component in the form, is to configure the connection string. Then select the (DynamicProperties) property in the Property Browser. Expand it and select the ConnectionString property. In the form that appears, mark the checkbox for making the value configurable. You can pick an easy-to-remember name for the key.
Now, when you close the dialog and save the form changes, you'll see a little green icon next to the ConnectionString property. If you open the App.config file, you'll find a new <appSettings> section, with a new key with the connection string value. From now on, you can modify the connection to the server just by changing this value in the file. You can reuse the same key from all forms.
Dig Deeper on Win Development Resources
Related Q&A from Daniel Cazzulino
Here Daniel Cazzulino explains how to load a DSL (domain specific language) domain model instance file programmatically. This requires the .NET type ... Continue Reading
Here we offer a glimpse at 12 of .NET development expert Danny Cazzulino's top ASP.NET questions and answers. Continue Reading
C# developers should NOT be modifying InitializeComponent method in the code-behind (or any of the variable definitions) by hand. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.