示例#1
0
文件: Form6.cs 项目: danisjie/EPC
        private void button1_Click(object sender, EventArgs e)
        {
            StringConnection s = StringConnection.Instance();

            s.Database = 数据库.Text;
            s.Uid      = 账号.Text;
            s.Pwd      = 密码.Text;

            var linq = new DataClasses1DataContext(s.ToString());

            var result = from info in linq.总包明细
                         select new
            {
                项目 = info.项目
            };

            try
            {
                foreach (var item in result)
                {
                }

                this.Visible = false;
                new Form1().Show();
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#2
0
 public static StringConnection Instance()
 {
     if (s_c == null)
     {
         s_c = new StringConnection();
     }
     return(s_c);
 }
示例#3
0
        private void query()
        {
            string c;

            if (textBox1.Text == "")
            {
                c = "Select 项目,SUM(开票金额) as 开票金额,sum(收票金额) as 收票金额 ,sum(收款金额) as 收款金额 ,sum(付款金额) as 付款金额,sum(收款调整金额) as 收款调整金额 From 总包明细 group by 项目";
            }
            else
            {
                c = "Select 项目,SUM(开票金额) as 开票金额,sum(收票金额) as 收票金额 ,sum(收款金额) as 收款金额 ,sum(付款金额) as 付款金额 ,sum(收款调整金额) as 收款调整金额 From 总包明细 WHERE 项目 like'%" + textBox1.Text + "%' group by 项目";
            }

            SqlCommand     cmd = new SqlCommand(StringConnection.Instance().ToString());
            SqlDataAdapter sda = new SqlDataAdapter(c, conn);

            DataSet ds = new DataSet();

            sda.Fill(ds, "cs");
            dataGridView1.DataSource = ds.Tables[0];
        }
示例#4
0
 private void Form4_Load(object sender, EventArgs e)
 {
     conn = new SqlConnection(StringConnection.Instance().ToString());
     query();
 }