
C#
学习总结
开始努力了1
专注SAP
展开
-
c# 操作mysql数据库的时候会出现 插入中文汉字变成问号?
场景: 在mysql ce里面执行时没有问题的。c#操作会出现问号。原因是: 链接字符串的时候 要设置Charset=utf8; 不然就会按默认的服务器设置编码,通常会出问题。 检查: 1、创建的数据库是按 utf8 编码格式。 2、表也是utf8格式。3、链接字符串增加Charset=utf8;比如: String sql = String....原创 2020-04-11 12:32:19 · 1653 阅读 · 0 评论 -
C#登录检查的两种写法
写法一: #region //增加区分代码块 if (this.radteacher.Checked)//选择单选按钮 { String constr = "server=127.0.0.1;userid=root;password=;database=dormd...原创 2020-03-16 00:52:31 · 265 阅读 · 0 评论 -
启动界面开发
1.属性:Text 窗体标题backcolor 背景色program.cs 应用程序的主入口点 application.run(new form1());设置启动窗体原创 2020-03-09 22:03:45 · 122 阅读 · 0 评论 -
求数字的阶乘及阶乘和
static void Main(string[] args) { int j = 1; Console.WriteLine("请输入要求的阶乘:"); int n = int.Parse(Console.ReadLine()); int ji...原创 2020-03-06 17:21:24 · 154 阅读 · 0 评论 -
求数组的平均值
static void Main(string[] args) { int[] avgs = new int[5]; int sum = 0; for(int i = 0; i < avgs.Length; i++) { Conso...原创 2020-03-06 16:58:01 · 1061 阅读 · 0 评论 -
数组格式的使用
数组:是一组相同数据类型的集合语法格式:数据类型[] 数组名 = new 数据类型 [长度] static void Main(string[] args) { String[] names = new string[5]; int[] salarys = new int[5]; //...原创 2020-03-05 10:13:47 · 179 阅读 · 0 评论 -
双重循环输出等腰三角形
{ // * // * * * // * * * * * // * * * * * * * //* * * * * * * * * class Program { static void Main(string[] args) { for(int...原创 2020-03-05 09:51:58 · 2331 阅读 · 0 评论 -
双重循环五层星
//* //* * //* * * //* * * * //* * * * * static void Main(string[] args) {//外层循环控制行数 循环嵌套不超过3个 for(int i = 1; i <= 5; i++) ...原创 2020-03-05 09:30:23 · 143 阅读 · 0 评论 -
字符串和类型转换
字符串的处理 String str = "今天是个好天气,我被今个老师批评了一顿,王新光,是个好同学"; Console.WriteLine(str.Contains("王新光")); Console.WriteLine(str.EndsWith("新光")); Console.WriteLine...原创 2020-03-05 09:12:03 · 107 阅读 · 0 评论 -
水仙花数案例
int bw, sw, gw; for(int i = 100; i <= 999; i++) { gw = i % 10; sw = i / 10 % 10; bw = i / 100; if...原创 2020-03-02 23:45:37 · 213 阅读 · 0 评论 -
四类循环格式
do while int i = 0; do { if (i % 2 == 0) Console.WriteLine(i); i++; } while (i<=100);while int...原创 2020-03-02 23:15:35 · 167 阅读 · 0 评论 -
占位符和if求最大值及switch分支语句
//占位符 int num1, num2; Console.WriteLine("请输入数字1:"); num1 = int.Parse(Console.ReadLine()); Console.WriteLine("请输入数字2:"); num2 = int.Parse(C...原创 2020-03-01 22:02:38 · 362 阅读 · 0 评论 -
求圆的面积
//圆的面积 S =PI*R*R const double PI = 3.1415926;//常量使用const定义 常量名大写 Console.WriteLine("请输入圆的半径"); int r; r=int.Parse(Console.ReadLine()); ...原创 2020-03-01 21:12:09 · 365 阅读 · 0 评论 -
C#基础
语法格式:区分大小写 命名空间:区分类 int age = 18; float height = 1.8F;//float类型后需加F double weight = 120;//C默认小数类型是double char flag = 'Y';//字符使用单引号 boo...原创 2020-03-01 21:10:36 · 96 阅读 · 0 评论 -
C#连接数据库
运用技术:ADO.NET access database object1.mysqlconnection 数据库连接对象2.mysqlcommand sql命令执行对象(增删改)3.mysqldataadapater 数据适配器(数据查询对象)1.1连接字符串 server=localhost prot=3306 database=test uid=root pwd=123o...原创 2020-02-26 01:37:06 · 115 阅读 · 0 评论