c# 数据库创建 学生信息系统的增删改查

1、SQL创建数据库和表

create database xuesheng
go
use xuesheng
go
create table login
(
	username varchar(50),
	pwd varchar (20),

)
go
create table information
(
	id int identity(1000,1)primary key,
	name varchar(20) not null,
	sex char(2),
	jiguan varchar(50),
	shijian varchar(50),
	minzu varchar(50),
	idcard   varchar(50),
	addr  varchar(50),	
)
go

2、c#登陆页面简易设计

![这里可自由设计](https://img-blog.csdnimg.cn/20191224225150324.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pfenlj,size_16,color_FFFFFF,t_70)

登陆代码

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 System.Data.SqlClient;

namespace WindowsFormsApplication1
{
   
    public partial class Form1 : Form
    {
   
        public static string name1;
        public Form1()
        {
   
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
   
            string constr = ("Data Source=.;Initial Catalog=a;Integrated Security=True");
            string username = txt_username.Text;
            string pwd = txt_pwd.Text;
            name1 = txt_username.Text;

            SqlConnection con = new SqlConnection(constr);
            SqlCommand cmd = new SqlCommand();

            cmd.Connection = con;
            cmd.CommandText = string.Format("select count (*)  from b where username like '{0}'and pwd like'{1}'",username ,pwd);

            con.Open();
            int i = Convert.ToInt32(cmd.ExecuteScalar()</
  • 0
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值