rabar kareem
rabar kareem

Reputation: 630

C# how to connect to sql server with sql authentication after making program exe by innosetup

I make a program , using c# and sql server with sql authentication , It works properly in my device , but after making the program setup file .exe extension using Innosetup , i cannot connect to my database , what I've tried is exporting my database in script , and run the script on another device , but it does not work , I think I need to create port or something to connect to this database , or in my app.config change the server name

Here is my connctoin string

 <connectionStrings>
    <add name="MarketDatabaseEntities" connectionString="metadata=res://*/AmanjCenter2Entity.csdl|res://*/AmanjCenter2Entity.ssdl|res://*/AmanjCenter2Entity.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=RABAR;initial catalog=MarketDatabase;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

Upvotes: 0

Views: 344

Answers (1)

Pradeep
Pradeep

Reputation: 3276

I see two points of failure here:

  1. Data source: Data source name is machine name. Is your target machine name "RABAR"? I guess not. If your database is installed on that machine, you can change data source to data source = (local).

  2. Integrated Security: You have set Integrated Security = true. This causes problem on target machine because you will have to configure SQL Server user and windows user accordingly. Instead of that trouble you can create a SQL Server user and configure your connection string that way i.e User Id = [SQL Server User]; password = SQL Server User's password.

HTH

Upvotes: 2

Related Questions