本文介绍了为什么在break语句中出错... plz告诉我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用System; 
使用System.Collections.Generic;使用System.ComponentModel
;
使用System.Data;使用System.Drawing
;
使用System.Linq;
使用System.Text;
使用System.Windows.Forms;
使用System.Data.SqlClient;
使用System.Configuration;

命名空间WindowsFormsApplication8
{
public partial class Form1:Form
{
SqlConnection conn = new SqlConnection(@Data Source = VISHAL-PC; Initial Catalog = arif; Integrated security = true);
SqlCommand cmd;
SqlDataReader dr;
string str;
int value1;
int value2;
int A;

public Form1()
{
InitializeComponent();
}



private void Form1_Load(object sender,EventArgs e)
{



}

private void textBox3_TextChanged(object sender,EventArgs e)
{

}




private void timer1_Tick_1(object sender,EventArgs e)
{





}



private void timer1_Tick_2(object sender,EventArgs e)
{
{
if(textBox1.Text!=&& textBox2。 Text!=)
{

value1 = Convert.ToInt32(textBox1.Text);
value2 = Convert.ToInt32(textBox2.Text);

textBox3.Text = DateTime.Now.ToString();
str =;
str =插入kkk值(+ textBox1.Text +,+ textBox2.Text +,+ textBox3.Text +');
cmd = new SqlCommand(str,conn);
conn.Open();
dr = cmd.ExecuteReader();

value1 = value1 + 1;
value2 = value2 + 1;
textBox1.Text = value1.ToString();
textBox2.Text = value2.ToString();
conn.Close();

}

其他
{
break;

}
}
}


}
}





我尝试了什么:



告诉我尽可能的....... ...................

解决方案




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.SqlClient;
using System.Configuration;

namespace WindowsFormsApplication8
{
    public partial class Form1 : Form
    {
        SqlConnection conn = new SqlConnection(@"Data Source=VISHAL-PC; Initial Catalog=arif; Integrated security=true");
        SqlCommand cmd;
        SqlDataReader dr;
        string str;
        int value1;
        int value2;
        int A;

        public Form1()
        {
            InitializeComponent();
        }



        private void Form1_Load(object sender, EventArgs e)
        {



        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }




        private void timer1_Tick_1(object sender, EventArgs e)
        {





        }



        private void timer1_Tick_2(object sender, EventArgs e)
        {
            {
                if (textBox1.Text != "" && textBox2.Text != "")
                {

                    value1 = Convert.ToInt32(textBox1.Text);
                    value2 = Convert.ToInt32(textBox2.Text);

                    textBox3.Text = DateTime.Now.ToString();
                    str = "";
                    str = "Insert into kkk values(" + textBox1.Text + "," + textBox2.Text + ",'" + textBox3.Text + "')";
                    cmd = new SqlCommand(str, conn);
                    conn.Open();
                    dr = cmd.ExecuteReader();

                    value1 = value1 + 1;
                    value2 = value2 + 1;
                    textBox1.Text = value1.ToString();
                    textBox2.Text = value2.ToString();
                    conn.Close();

                }

                else
                {
                    break;

                }
            }
        }


        }
}



What I have tried:

tell me faast as possible..........................

解决方案




这篇关于为什么在break语句中出错... plz告诉我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 11:42