Search code examples
c#winformsmdf

Won't connect MDF file to WinForms on another PC


I use LocalDB (.MDF) for, VS 2022 community on PC1. I connected C# WinForms App to localdb .MDF file with OpenFileDialog and everything works on PC1, but I would like to run that WinForms App with same MDF file on PC2 without VS 2022. I transfered bin\Debug Folder to PC2.

PC2 error message:
Error Message Here is DB Connection Link (textBox1.Text is MDF file path): conn.ConnectionString = @"Data Source=(localdb)\MSSQLLocalDB; AttachDbFilename="+ textBox1.Text +"; Integrated Security=True;";


Solution

  • Fixed. LocalDB wasn't installed.