71119

MySqlConnection.StateChange is never Fetching

Question:

How MySqlConnection.StateChange does work?

I have following code.

conn.StateChange += ConnectionStateChanged; private void ConnectionStateChanged(Object sender, StateChangeEventArgs e) { switch (e.CurrentState) { // is never equal to Fetching } } public DataTable Query(string query) { DataTable dt = new DataTable(); using (MySqlDataAdapter a = new MySqlDataAdapter(query, conn)) { try { a.SelectCommand.CommandTimeout = 5; a.Fill(dt); } catch { return null; } } return dt; }

Why ConnectionStateChanged is never called with ConnectionState.Fetching nor ConnectionState.Executing?

Answer1:

Well, I may misunderstand <a href="http://msdn.microsoft.com/en-us/library/system.data.connectionstate%28v=vs.110%29.aspx" rel="nofollow">msdn</a>, but these states don't seem to be implemented (the enum values are just "reserved", even in .net 4.5) :

<blockquote>

<strong>Executing</strong> The connection object is executing a command. (This value is reserved for future versions of the product.)

</blockquote>

and

<blockquote>

<strong>Fetching</strong> The connection object is retrieving data. (This value is reserved for future versions of the product.)

</blockquote>

Recommend

  • MySqlConnection.StateChange is never Fetching
  • Add columns to dataset to be used as XML parent nodes
  • previous state object of onFlushDirty()
  • How to Add OnClick event on Image in WPF Programmatically [duplicate]
  • Performance of log4j2 compared to log4j1
  • Flex element includein
  • MySqlCommand Parameter not Working
  • Silverlight xaml TextBlock.Text with CDATA not showing up at runtime?
  • Android kernel compile error gcc6 linaro 6
  • Select document having particular key value pair but not having other key value pair
  • Trying to Get SQS Message ID with Boto
  • Unable to add the file iOS application bundle
  • RewriteCond and rewriteRule to redirect depending on the domain
  • What to do if “git push heroku master” failed?
  • How do I generate data for Google Visualizations on the server using WebSharper
  • use images instead of text in webgrid asp mvc
  • How read between delimiters in php DOM of a XML file?
  • Two columns in subquery in where clause
  • Gforce min not supported for character in data.table
  • reduce/reduce conflicts using ocamlyacc
  • How to write string.Contains(someText) in expression Tree
  • How to get the index of element in the List in c#
  • Rails AREL .where statement
  • Heroku push rejected - Hartl's Rails 3.2 tutorial
  • Adding Parent and Child Nodes in TreeView from Sql Server 2008
  • ActiveRecord query for a count of new users by day
  • Can you perform a UNION without a subquery in SQLAlchemy?
  • PostgreSQL Query without WHERE only ORDER BY and LIMIT doesn't use index
  • Retrieving value from sql ExecuteScalar()
  • Display Images one by one with next and previous functionality
  • Cannot Parse HTML Data Using Android / JSOUP
  • SQL merge duplicate rows and join values that are different
  • JTable with a ScrollPane misbehaving
  • unknown Exception android
  • failed to connect to specific WiFi in android programmatically
  • How can I use threading to 'tick' a timer to be accessed by other threads?