title: Data is not updated into the database?
body: <p>I wish to insert and update the data from the textbox.</p>
  
  <p>Why my data is not updated into the database? (Microsoft SQL Server Management Studio) Anyone please help me. Appreciate!</p>
  
  <pre><code>    //connection    
  
      //update 
      If dt.Rows.Count &gt; 0 Then
  
          If dt.Rows.Count &gt; 0 Then
  
          sql = "Update adm SET qty = '" &amp; txtqty.Text &amp; "' Where xxx = '" &amp; Trim(Session("xxx")) &amp; "' "
          cmd = New SqlCommand(sql, conn)
          'conn.open()
          cmd.ExecuteNonQuery()
  
          txtqty.Text = ""
  
      Else
  // do insert    
      crow = ds.tables("adm").newrow()
  
      crow("xxx") = Session("xxxx")
      crow("xxx") = Session("xxx")
      crow("xxx") = xxxxx
      crow("xxx") = xxxxx
      crow("xxxxx") = xxxxx
      crow("xxxx") = xxxxx
      crow("xxxxx") = xxxxx
      crow("xxxx") = xxxxx
      crow("xxxx") = xxxxx
      crow("qty") = trim(txtqty.text)
  
      ds.tables("adm").rows.add(crow)
  
      da.update(ds, "adm")
  
      lbl.Text = "&lt;strong&gt;Data saved! &lt;/font&gt;&lt;/strong&gt;"
  
      conn.close()
  
  End If
  </code></pre>
  
  <p>Here is the connection</p>
  
  <pre><code>    sql = "SELECT * FROM adm  "
      conn = New SqlConnection(ConnStr)
      cmd = New SqlCommand(sql, conn)
      conn.open()
      da = New SqlDataAdapter(cmd)
      cb = New SqlCommandBuilder(da)
      ds = New DataSet
      da.fill(ds, "adm")
      dt = ds.Tables(0)
  </code></pre>