Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You didn't show us your <strong>connection string</strong> - but I'm just guessing from the "symptoms" you report.</p> <p>The whole <em>User Instance and AttachDbFileName=</em> approach is flawed - at best! When running your app in Visual Studio, it will be copying around the <code>.mdf</code> file (from your <code>App_Data</code> directory to the output directory - typically <code>.\bin\debug</code> - where you app runs) and <strong>most likely</strong>, your <code>INSERT</code> works just fine - but you're just looking at the <strong>wrong .mdf file</strong> in the end! </p> <p>If you want to stick with this approach, then try putting a breakpoint on the <code>myConnection.Close()</code> call - and then inspect the <code>.mdf</code> file with SQL Server Mgmt Studio Express - I'm almost certain your data is there.</p> <p>The <strong>real solution</strong> in my opinion would be to </p> <ol> <li><p>install SQL Server Express (and you've already done that anyway)</p></li> <li><p>install SQL Server Management Studio Express</p></li> <li><p>create your database in <strong>SSMS Express</strong>, give it a logical name (e.g. <code>MyDB</code>) </p></li> <li><p>connect to it using its logical <strong>database name</strong> (given when you create it on the server) - and don't mess around with physical database files and user instances. In that case, your connection string would be something like:</p> <pre><code>Data Source=.\\SQLEXPRESS;Database=MyDB;Integrated Security=True </code></pre> <p>and everything else is <strong>exactly</strong> the same as before...</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload