zoukankan      html  css  js  c++  java
  • 修改

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data.SqlClient;
    
    
    namespace ado修改
    {
        class Program
        {
            static void Main(string[] args)
            {
                //1、让用户输入要修改的学生编号
                Console.Write("请输入要修改的学生编号:");
                string Scode = Console.ReadLine();
                Console.Write("请输入更改后的学生姓名:");
                string Sname = Console.ReadLine();
                Console.Write("请输入更改后的学生性别:");
                bool Ssex = Convert.ToBoolean(Console.ReadLine());
                Console.Write("请输入更改后的学生生日:");
                DateTime Sbirthday = Convert.ToDateTime(Console.ReadLine());
                Console.Write("请输入更改后的学生成绩:");
                decimal Sscore = Convert.ToDecimal(Console.ReadLine());
    
                //2、执行修改
                SqlConnection conn = new SqlConnection("server=.;database=Data0425;user=sa;pwd=123;");
                SqlCommand cmd = conn.CreateCommand();
                cmd.CommandText = "update student set name='" + Sname + "',sex='" + Ssex + "',birthday='" + Sbirthday + "',score=" + Sscore + " where code = '" + Scode + "'";
    
                conn.Open();
                cmd.ExecuteNonQuery();
                Console.WriteLine("修改成功!");
                conn.Close();
                Console.ReadLine();
            }
        }
    }
  • 相关阅读:
    [LOJ#6284.数列分块入门8] ODT(珂朵莉树)解法
    [CF Contest] Sum of Round Numbers 题解
    基础数论记录
    [CF Contest] Kana and Dragon Quest game 题解
    hexo上怎么写博客
    keepalived的部署
    python局部和全局变量
    python发送邮件
    lamp架构的部署
    rayns数据同步
  • 原文地址:https://www.cnblogs.com/zhangdemin/p/5604091.html
Copyright © 2011-2022 走看看