标题:求助:总报“执行 CreateHandle() 时无法调用值 Dispose()。”或“未将对象 ...
取消只看楼主
sxfplf
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-8-12
结帖率:0
已结贴  问题点数:10 回复次数:0 
求助:总报“执行 CreateHandle() 时无法调用值 Dispose()。”或“未将对象引用设置到对象的实例。”
namespace ShowDataGridView
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
        }

        int time=0;

        private void ShowDataGridView()
        {
            using (SqlConnection conn = new SqlConnection(@"server=.\SQLEXPRESS;database=DataSqlExpress;uid=datawriter;pwd=123456"))
            {

                SqlDataAdapter da = new SqlDataAdapter("select * from Temp_TABLE", conn);
                DataSet ds = new DataSet();
                da.Fill(ds);
                dataGridView.DataSource = ds.Tables[0];
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {                       
            this.timer1.Interval=1000;
            this.timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            time++;
            if (time >= 10)
            {
                Thread td = new Thread(new ThreadStart(ShowDataGridView));
                td.Start();
                time = 0;
            }
        }
    }
}


如题,求助!!
搜索更多相关主题的帖子: database private public server false 
2013-09-04 12:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-420080-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.214832 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved