Danelo Danelo - 1 year ago 179
MySQL Question

Microsoft Visual Studio SQL server connection - invalid pointer

enter image description here

So, I want to create a SQL database in Microsoft SQL Management Studio and connect it to Microsoft Visual Studio. I linked the database to Visual Studio and it worked. Now, I want to open that connection to test it with a button on a windows form application. Every time I try, it says "invalid pointer" but the database name is correct. I don't know what is wrong.

I still get the invalid pointer error...My instance name is DESKTOP-BJSAO6B but it doesnt seem to work...

Answer Source

You need provide a proper connection string like

string connectionString =
        "data source=.\SQLEXPRESS;initial catalog=student;integrated security=True;";

    using (SqlConnection connection =
        new SqlConnection(connectionString))
 MessageBox.Show("You are connected");

where SQLEXPRESS - name your MSSQL instance ( may be different). More you can see here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download