-1

i have some question about VB.NET or Visual Studio app. Alright let me start with app..i completely finished my work with build an app that will store, edit, import and others thing for my app using SQL Server Management Studio, My PC is the host for the server for that app...the app that i publish in my pc work fine and there were no error occur.. But when i copy the published file into others PC and install the app.. the error occur because its can't connect to my server.. how do i publish correctly so that i can install the app for other pc

Dim conn As New SqlConnection("Server=MYA02W00018;Database=PHMTest;Integrated Security = True")

This is the connection string

enter image description here

im sorry i should send this error firstly back then

Answer : my bad its because the other pc not join the domain after i join the domain the error occur that the login id from an untrusted domain and cannot be used with integrated authentication .. then i just change server authentication as SQL and windows authentication at SQL Server Management and after that just Integrated Security = True i just need to remove it.. know i already got to login Thanks for helping guys

lowkey
  • 19
  • 4
  • Can you paste the code in VB.NET where you connect to the SQL Server? Or at least the connection string (without real passwords, of course). – Carlos Oct 18 '21 at 07:56
  • @Carlos done..i dont know why the error occur at others pc.. but mine doesn't – lowkey Oct 18 '21 at 08:07
  • Use a server which all the machines can access in order to host the database. Hosting it on your own pc is a bad idea. – ADyson Oct 18 '21 at 08:12
  • @ADyson its just a test for me to learn about programming..and also there were people at my work place do something like this and the pc just for server – lowkey Oct 18 '21 at 08:20
  • That doesn't make it a good idea – ADyson Oct 18 '21 at 11:46
  • @lowkey take a look at this: https://stackoverflow.com/questions/5435090/sql-server-was-not-found-or-was-not-accessible – Carlos Oct 18 '21 at 16:08

2 Answers2

0

Open installation location of your app. You will find a file that shares name with your app e.g. if your app name is biz_monitor, the file will be named biz_monitor.exe.configbiz_monitor as shown in attached image

Open that file using text editor e.g notepad. Locate these lines:

  connectionStrings>
            <add name="Biz_monitor.My.MySettings.constring" connectionString="server=myserver_ip;user id=my_username;password=mypassword;database=mydatabase;procedure cache size=50;use performance monitor=True;use usage advisor=True;logging=True;connection reset=True"
                providerName="MySql.Data.MySqlClient" />
           
        </connectionStrings>

Edit: 1. server to ip address of the machine hosting sql server, 2. database to name of your database, 3.user id to your user name 4. Password to password of your sql server

Then ensure there is no firewall or antivirus blocking your connection. Test and give feedback

  1. ping the server using it's ip address. Assign static ip'S if you have not done so. if ping will work , network connection is established , if not fix network first. Then structure your connection string like this: Connstring = "Data Source=" & Server & ";Initial Catalog=" & DbName & ";User ID=" & User & ";Password=" & Pass & ""

configure your SQL server to use 'SQL Server Authentication'

-1

Now i already got the answer it just Integrated Security = True i just need to remove it..know i already got to login Thanks for helping guys

lowkey
  • 19
  • 4
  • Please provide this information in your question and mark it as solved. Throughout that you can create a progress in your question, which is highly recommended rather than posting an answer to your own answer. Anyways if you still want to answer your own question, you should give more details why this fixed your problem. – Maik Hasler Oct 20 '21 at 06:27
  • @MΛIK alright thank you... i just dont know what to do after got answer..im new with this – lowkey Oct 20 '21 at 06:42