Ejemplo n.º 1
0
        //提取数据
        private void button1_Click(object sender, EventArgs e)
        {
            //提取数据
            string        connstr = "server=s1.hzcrj.com,1999;database=TRQC;user=sa;pwd=hc3232327";
            SqlConnection Conn1   = new SqlConnection(connstr);

            try
            {
                using (Conn1)
                {
                    Conn1.Open();
                    string     sql   = "select top 30 [存货编码] ,[存货名称],cast(cast([数量] as int) as varchar(50)) as 数量,[计量单位] as 单位 from [InvQC]";
                    SqlCommand Comm1 = new SqlCommand(sql, Conn1);
                    Comm1.CommandTimeout = 20;
                    SqlDataAdapter SDA = new SqlDataAdapter();
                    SDA.SelectCommand = Comm1;
                    DataSet ds = new DataSet();
                    SDA.Fill(ds, "cs");
                    dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 16);
                    dataGridView1.DataSource            = ds.Tables[0];
                    Form pwd = new LoginBox();

                    richTextBox1.Text = "提取成功" + dataGridView1.Rows[1].Cells[1].Value + "|" + AppDataList.Temp_Char;
                }
            }
            catch (Exception ex)
            {
                richTextBox1.Text = ex.Message;
            }
            finally
            {
                Conn1.Close();
            }
        }
Ejemplo n.º 2
0
 //注销登陆
 private void LogoutAPP_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要注销登陆用户么?", "注销登陆", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         AppDataList.Logined  = false;
         AppDataList.UserName = "******";
         this.Hide();
         Form MR = new LoginBox();
         MR.ShowDialog();
         this.Close();
     }
 }