title: No data available after an Insert operation VB.NET - Windows Forms and Web Service
body: <p>VB.NET and ASMX Web Service. I am still having the same trouble of getting no data after an insert operation.</p>
  <p>Here is my insert code:</p>
  <pre><code>Try
      'create a MySqlCommand to represent the query
      If sqlConn.State = ConnectionState.Closed Then
          sqlConn = New MySqlConnection(conStr)
          sqlConn.Open()
      End If
  
      Dim myCommand As MySqlCommand = New MySqlCommand(strQuery, sqlConn)
      If myCommand.ExecuteNonQuery() &lt;&gt; 0 Then
          Result = True
      End If
  Catch ex As Exception
      Throw New ApplicationException(&quot;Error-luckie's server 2 &quot; &amp; ex.Message)
  Finally
      sqlConn.Close()
      sqlConn.Dispose()
  End Try
  </code></pre>
  <p>The strQuery will be a simple insert statement.</p>
  <p>The code for retrieving data as a dataset is as follows</p>
  <pre><code>Public Function ExecuteQuery(ByVal strQuery As String) As DataSet
      Dim ds As DataSet = New DataSet 'create a DataSet to hold the results
  
      Try
          'create a MySqlCommand to represent the query
          If sqlConn.State = ConnectionState.Closed Then
              sqlConn = New MySqlConnection(conStr)
              sqlConn.Open()
          End If
  
          Dim sqlcmd As MySqlCommand = sqlConn.CreateCommand()
          sqlcmd.CommandType = CommandType.Text
          sqlcmd.CommandText = strQuery
  
          'create a MySqlDataAdapter object
          Dim sqlDa As MySqlDataAdapter = New MySqlDataAdapter
          sqlDa.SelectCommand = sqlcmd
  
          Try
              'fill the DataSet using the DataAdapter
              sqlDa.Fill(ds, &quot;Results&quot;)
          Catch ex As Exception
              Throw New ApplicationException(&quot;Error-luckie's server 1 &quot; &amp; ex.Message)
          End Try
  
      Catch ex As Exception
          Throw New ApplicationException(&quot;Error-luckie's server 2 &quot; &amp; ex.Message)
      Finally
          sqlConn.Close()
          sqlConn.Dispose()
      End Try
  
      Return ds
  End Function
  </code></pre>
  <p><strong>I am Inserting data from one thread and retrieving data from another (not the same instance of connection is used).</strong></p>
  <blockquote>
  <p>This works perfect if I retrieve data after a 15 minutes gap.</p>
  <p>But I want to get the result at once.
  Please help.</p>
  </blockquote>