You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio中DataGridView调试加载缓慢问题求助

DataGridView加载异常问题

问题现象

  • 在Visual Studio 2022的Debug模式下运行应用时,Resident's Information DatagridView 加载耗时极长
  • 直接运行Debug文件夹下的外部.exe文件时,DataGridView加载速度快、无延迟

已尝试的无效操作

  • 清理项目/解决方案
  • 重新构建项目

DataGridView填充代码

mySQLCommand.CommandText = "Select * From residents" & (IIf(txtSearchResident.Text.Trim = "" Or txtSearchResident.Text = "Type in your search", " ", " WHERE first_name LIKE @resident_name OR middle_name LIKE @resident_name OR last_name LIKE @resident_name")) & " order by first_name asc limit 30 OFFSET " & (((CInt(Me.txtPageNoResident.Text)) - 1) * 30)
mySQLCommand.Parameters.AddWithValue("@resident_name", "%" & txtSearchResident.Text & "%")
mySQLReader = mySQLCommand.ExecuteReader

While mySQLReader.Read
        Dim middle, ext As String
        If mySQLReader!middle_name <> DBNull.Value Then
            middle = mySQLReader!middle_name + " "
        Else
            middle = ""
        End If

        If mySQLReader!ext_name <> DBNull.Value Then
            ext = mySQLReader!ext_name
        Else
            ext = ""
        End If

        datagrid.Rows.Add(New String() {(mySQLReader!first_name + " " + middle + mySQLReader!last_name + " " + ext), mySQLReader!sex, mySQLReader!is_voter, mySQLReader!contact_no})

End While

开发环境

  • 语言:Visual Basic .Net
  • IDE:Visual Studio 2022
  • 数据库:XAMPP搭建的MySQL

内容的提问来源于stack exchange,提问作者Jayvee Jimenez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 16:50:21