Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I created Database file with SQL Server Manager 2017 using SQL Server 2014.
So when i try to connect my database file in Visual Studio 2017 with c# i get this error...

Also i don`t have problem when i Use Tools>Connect to Database from Visual Studio

(System.ArgumentException: 'Option not supported.
Parameter name: attachdbfilename')

<
InitializeComponent();
            string cs = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\PC\Desktop\Database\Database.mdf;Integrated Security=True;Connect Timeout=30";
            MySqlConnection con = new MySqlConnection(cs); //error here
            con.Open();
>

What I have tried:

.............................................................................
Posted
Updated 8-Jun-18 7:18am
v2

1 solution

You're trying to use a "MySQL" connection (for a MySQL database) to connect to an MS SQL Server database.

You need a "different" connection.

C# SQL Server Connection[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900