using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.Odbc; namespace bug67920 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { IDbConnection _connection = new OdbcConnection(); _connection.ConnectionString = "Driver={MySQL ODBC 5.2w Driver};Server=localhost;Database=test;User=********;"; _connection.Open(); IDbCommand command = _connection.CreateCommand(); command.CommandText = "drop table if exists bug67920"; command.ExecuteNonQuery(); command.CommandText = "create table bug67920(id int, vc varchar(32))"; command.ExecuteNonQuery(); command.CommandText = "insert into bug67920(id, vc) values (99, 'Ninety Nine')"; command.ExecuteNonQuery(); command.CommandText = "select * from film"; IDataReader reader = command.ExecuteReader(CommandBehavior.SchemaOnly); while (reader.Read()) { // do nothing just read all records } if (reader != null && !reader.IsClosed) reader.Close(); } } }