title: How to insert data on SQL Server Database in VB.NET?
body: <p>has anyone know how to insert some data on SQL Server database??
  i've tried this code, but it not works for me..
  here's the code:</p>
  
  <pre><code>    Dim constring As String = "Data source=.\sqlexpress;attachDbFilename=|DataDirectory|\Database1.mdf;integrated security=true;connect timeout=30;user instance=true"
      Dim connection As SqlConnection = New SqlConnection(constring)
      Dim query As SqlCommand
  
          Dim s As String
  
          connection.Open()
  
          s = "insert into login values(@un,@pass)"
          query = New SqlCommand(s, connection)
          query.Parameters.AddWithValue("@un", "111")
          query.Parameters.AddWithValue("@pass", "222")
  
          query.ExecuteNonQuery()
  
          connection.Close()
  </code></pre>