title: How to pass a DataTable to Mysql
body: <p>I have a winforms application connected to Mysql using the .Net driver. I written a class to handle to all the database functionality. I use a dataTable to store query results for binding from mysql.</p>
  
  <pre><code>Imports MySql.Data.MySqlClient
  Imports System.IO
  
  Public Class MysqlConSjC
  
  Private conn As MySqlConnection
  Private connStr As String
  Public strace As String
  Private status As Integer
  
  'status member variable for connectivity. 0 for success, 
  'value of one indicates db connection error
  'value of 2 indicates query failure
  
  Private comd As MySqlCommand
  Private adpter As MySqlDataAdapter
  Private dta As DataTable
  
  Public Sub Query(ByVal SQl As String)
  
      Try
          comd.Connection = conn
          comd.CommandText = SQl
          adpter.SelectCommand = comd
          adpter.Fill(dta)
          status = 0
  
      Catch ex As MySqlException
          strace = ex.StackTrace()
          DisconnectMysql()
          status = 2
  
      End Try
     End Sub
  </code></pre>
  
  <p>This method does a select query. How would I write a method to insert/update/delete rows of the DataTable in the database?</p>