ER图
智慧商超主要框架数据表
建立数据库并创建收银员信息表(users)
CREATE DATABASE malin2017270087;
USE malin2017270087;
create table users(
//id 为主关键字
id int primary key ,
name varchar(50),
passwords varchar(50),
phone varchar(15)
)
insert into users values
(1001,'老赵','123','13333333333'),
(1002,'老钱','123','13444444444'),
(1003,'老孙','123','13555555555'),
(1004,'老李','123','13666666666')
select * from users;
代码
####Form1的加载事件
>
private void Form1_Load(object sender, EventArgs e)
{
SqlConnection conn;
string conStr = "Data Source=.;Initial Catalog=malin2017270087;Integrated Security=True";
conn =new SqlConnection(conStr);
conn.Open();
string strsql = "select * from users";
SqlDataAdapter adapter = new SqlDataAdapter(strsql, conn);
DataSet ds =new DataSet();
adapter.Fill(ds, "users");
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
网友评论