连接Access数据库代码,以及.Net4.0版本的报表查询代码

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 data1;
using DA1;
using data5;
using DA5;

namespace 连接仓库.管理员
{
    public partial class denglu : Form
    {
        public denglu()
        {
            InitializeComponent();
        }

        private void denglu_Load(object sender, EventArgs e)
        {
            
            List<zhucehoutaidata5> list = new zhucehoutaiDA().Select1();
            if (list!=null)
            {
                foreach (zhucehoutaidata5 x in list)
                {
                    comboBox1.Items.Add(x.Nicheng);    
                }
            }
        }
        //点击登录按钮
        private void button1_Click(object sender, EventArgs e)
        {
            string nicheng=comboBox1.Text;
            string mima=textBox1 .Text ;
            List<zhucehoutaidata5> list = new zhucehoutaiDA().Select(nicheng,mima);
            if (list != null)
            {
                MessageBox.Show("登录成功");
                cangkuguanli f = new cangkuguanli();
                this.Owner = f;
                f.WindowState = FormWindowState.Maximized; //这句话什么意思
                this.Visible = false;
                f.Show();
            }
            else
            {
                MessageBox.Show("登录失败");
            }

            
            /*if (list != null)
            {
                foreach (zhigongdata x in list)
                {
                    comboBox1.Items.Add(x.Cno);
                    comboBox2.Items.Add(x.Zno);
                }
               
            }
            if (comboBox1.Text == comboBox1.Items[0].ToString() && comboBox2.Text == comboBox2.Items[1].ToString())
            {
                MessageBox.Show("登录成功");
                cangkuguanli f = new cangkuguanli();
                this.Owner = f;
                f.WindowState = FormWindowState.Maximized; //这句话什么意思
                this.Visible = false;  
                f.Show();
            }
            else
            {
                MessageBox.Show("登录失败");
            }*/
        }
        //当点击注册的时候
        private void button2_Click(object sender, EventArgs e)
        {
            zhucejiemian f = new zhucejiemian();
    
            this.Visible = false;
            this.Owner = f;
            f.Show();
        }
    }
}

 

.Net4.0报表的查询代码

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 data1;
using DA1;
using data5;
using DA5;

namespace 连接仓库.管理员
{
    public partial class denglu : Form
    {
        public denglu()
        {
            InitializeComponent();
        }

        private void denglu_Load(object sender, EventArgs e)
        {
            
            List<zhucehoutaidata5> list = new zhucehoutaiDA().Select1();
            if (list!=null)
            {
                foreach (zhucehoutaidata5 x in list)
                {
                    comboBox1.Items.Add(x.Nicheng);    
                }
            }
        }
        //点击登录按钮
        private void button1_Click(object sender, EventArgs e)
        {
            string nicheng=comboBox1.Text;
            string mima=textBox1 .Text ;
            List<zhucehoutaidata5> list = new zhucehoutaiDA().Select(nicheng,mima);
            if (list != null)
            {
                MessageBox.Show("登录成功");
                cangkuguanli f = new cangkuguanli();
                this.Owner = f;
                f.WindowState = FormWindowState.Maximized; //这句话什么意思
                this.Visible = false;
                f.Show();
            }
            else
            {
                MessageBox.Show("登录失败");
            }

            
            /*if (list != null)
            {
                foreach (zhigongdata x in list)
                {
                    comboBox1.Items.Add(x.Cno);
                    comboBox2.Items.Add(x.Zno);
                }
               
            }
            if (comboBox1.Text == comboBox1.Items[0].ToString() && comboBox2.Text == comboBox2.Items[1].ToString())
            {
                MessageBox.Show("登录成功");
                cangkuguanli f = new cangkuguanli();
                this.Owner = f;
                f.WindowState = FormWindowState.Maximized; //这句话什么意思
                this.Visible = false;  
                f.Show();
            }
            else
            {
                MessageBox.Show("登录失败");
            }*/
        }
        //当点击注册的时候
        private void button2_Click(object sender, EventArgs e)
        {
            zhucejiemian f = new zhucejiemian();
    
            this.Visible = false;
            this.Owner = f;
            f.Show();
        }
    }
}

 

posted @ 2015-06-27 20:56  zhenximeiyitian  阅读(273)  评论(0编辑  收藏  举报