title: Insert Values Into Database using ListBox
body: <p>I have the following code. My problem is I can't insert a record in my table and when I run the code there is no error. What is wrong with the code? </p>
  
  <pre><code>    Dim Conn As SqlConnection
      Dim cmd As SqlCommand
      Dim ConString As String
  
  
      ConString = "SERVER=MAXPAYNE-PC\DEVELOPER;DATABASE=sample;User=sa;Pwd=bwd"
      Conn = New SqlConnection(ConString)
      Try
          Conn.Open()
          For J As Integer = 0 To ListBox3.Items.Count - 1
              cmd = New SqlCommand("INSERT INTO players (name) VALUES (" &amp; ListBox3.Items(J).ToString &amp; ")")
              cmd.ExecuteNonQuery()
          Next
          Conn.Close()
      Catch ex As Exception
      End Try
  </code></pre>