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;namespace personmanagement
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
} private void groupBox1_Enter(object sender, EventArgs e)
{ } private void label1_Click(object sender, EventArgs e)
{ } private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.showDialog();
} private void groupBox2_Enter(object sender, EventArgs e)
{ } private void button6_Click(object sender, EventArgs e)
{
Form6 f6 = new Form6();
f6.showDialog();
} private void button2_Click(object sender, EventArgs e)
{
Form5 f5 = new Form5();
f5.showDialog();
} private void button3_Click(object sender, EventArgs e)
{
Form3 f3 = new Form3();
f3.showDialog();
} private void button4_Click(object sender, EventArgs e)
{
Form4 f4 = new Form4();
f4.showDialog();
} private void button7_Click(object sender, EventArgs e)
{
Application.Exit();
}
private string myConnectionString = @"Data Source=.;Initial Catalog=personmanagement;Integrated Security=True";
private void button5_Click(object sender, EventArgs e)
{
OledbConnection cnn = new OledbConnection(myConnectionString);
cnn.Open();
string sql ="select 性别,cout(*) as 数量 from person group by 性别";
OledbConnection cmd = new OledbConnection(sql,cnn);
cmd.CommandType=CommandType.Text;
OledbConnection odr= cmd.ExecuteReader();
odr.Read();
string m1=odr[0].ToString();
string m1_count=odr[1].ToString();
odr.Read();
string m2=odr[0].ToString();
string m2_count=odr[1].ToString();
odr.Close();
string display = string.Format
("{0} 人数; {1}\n\n{2} 人数: {3}",m1,m1_count,m2,m2_count);
MessageBox.Show (display,"统计性别");
}
}
}
}
提示错误1应输入类型、命名空间定义或文件尾??
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace personmanagement
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
} private void groupBox1_Enter(object sender, EventArgs e)
{ } private void label1_Click(object sender, EventArgs e)
{ } private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.showDialog();
} private void groupBox2_Enter(object sender, EventArgs e)
{ } private void button6_Click(object sender, EventArgs e)
{
Form6 f6 = new Form6();
f6.showDialog();
} private void button2_Click(object sender, EventArgs e)
{
Form5 f5 = new Form5();
f5.showDialog();
} private void button3_Click(object sender, EventArgs e)
{
Form3 f3 = new Form3();
f3.showDialog();
} private void button4_Click(object sender, EventArgs e)
{
Form4 f4 = new Form4();
f4.showDialog();
} private void button7_Click(object sender, EventArgs e)
{
Application.Exit();
}
private string myConnectionString = @"Data Source=.;Initial Catalog=personmanagement;Integrated Security=True";
private void button5_Click(object sender, EventArgs e)
{
OledbConnection cnn = new OledbConnection(myConnectionString);
cnn.Open();
string sql ="select 性别,cout(*) as 数量 from person group by 性别";
OledbConnection cmd = new OledbConnection(sql,cnn);
cmd.CommandType=CommandType.Text;
OledbConnection odr= cmd.ExecuteReader();
odr.Read();
string m1=odr[0].ToString();
string m1_count=odr[1].ToString();
odr.Read();
string m2=odr[0].ToString();
string m2_count=odr[1].ToString();
odr.Close();
string display = string.Format
("{0} 人数; {1}\n\n{2} 人数: {3}",m1,m1_count,m2,m2_count);
MessageBox.Show (display,"统计性别");
}
}
}
}
提示错误1应输入类型、命名空间定义或文件尾??
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货