Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot see my Data in Tables
    primarykey
    data
    text
    <p>I am creating a simple WPF Application with a Sql Connection. The problem is that when i debug the program it seems to be OK ( no errors ), but i cannot see my Data in the database.</p> <pre><code>private void button1_Click(object sender, RoutedEventArgs e) { System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(); conn.ConnectionString = @"DataSource=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MIKE.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; try { SqlCommand SqlCmd = new System.Data.SqlClient.SqlCommand("INSERT INTO [Customer](FirstName,LastName) VALUES(@FirstName,@LastName)", conn); conn.Open(); // Insert code to process data. SqlCmd.Parameters.AddWithValue("@FirstName", CUCFirstName.Text); SqlCmd.Parameters.AddWithValue("@LastName", CUClastName.Text); SqlCmd.ExecuteNonQuery(); } catch (SqlException ex) { MessageBox.Show(ex.Message, ex.Number.ToString()); } finally { conn.Close(); } } </code></pre> <p>and my xaml code </p> <pre><code> &lt;Grid&gt; &lt;Button Content="Add" Height="66" HorizontalAlignment="Left" Margin="324,233,0,0" Name="button1" VerticalAlignment="Top" Width="135" Click="button1_Click" /&gt; &lt;TextBox Height="36" HorizontalAlignment="Left" Margin="74,32,0,0" Name="CUCFirstName" VerticalAlignment="Top" Width="242"&gt; &lt;/TextBox&gt; &lt;TextBox Height="39" HorizontalAlignment="Left" Margin="74,74,0,0" Name="CUClastName" VerticalAlignment="Top" Width="242"&gt; &lt;/TextBox&gt; &lt;Label Content="First Name" Height="33" HorizontalAlignment="Left" Margin="324,32,0,0" Name="label1" VerticalAlignment="Top" Width="151" /&gt; &lt;Label Content="Last Name" Height="34" HorizontalAlignment="Left" Margin="324,72,0,0" Name="label2" VerticalAlignment="Top" Width="151" /&gt; &lt;/Grid&gt; </code></pre>
    singulars
    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. 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