@hamed algazaly ，you could try the following steps to avoid the error you get when you access the database in another machine.
First, Please place your mdf file in your
Second, you could set the connection string by using DataDirectory in the App.Config.
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> </startup> <connectionStrings> <clear /> <add name="conn" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\School.mdf;Integrated Security=True" providerName="System.Data.sqlclient" /> </connectionStrings> </configuration>
Based on my test, I can connect the database successfully when I run the app in another computer.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.