返回首页

try

           {

               sqlConnection.Open();

               sqlCommand = new SqlCommand(strQuery, sqlConnection);

               sqlReader = sqlCommand.ExecuteReader();

 

               while (sqlReader.Read())

               {

 

                   object[] row = { sqlReader[0]};

                   dataGridView1.Rows.Add(row);

               }

 

           }

           catch (Exception exc)

           {

               MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

               return;

           }

           finally

           {

               Cursor.Current = Cursors.Default;

               sqlConnection.Close();

               if (sqlReader != null)

               {

                   sqlReader.Dispose();

                   sqlReader = null;

               }

               if (sqlCommand != null)

               {

                   sqlCommand.Dispose();

                   sqlCommand = null;

               }

           }

       }
我看到系统挂在同时执行这条线的C1}在GridView没有显示,但,当我添加messagebox.show,("代码检查");比记录显示每次从数据库中挑选数据

任何建议

回答

评论会员:N 时间:2