自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 资源 (1)
  • 收藏
  • 关注

原创 OPCautomation异步读取数据时返回的值顺序错乱!解决

测试代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using OPCAutomation;using System.Net;using System.Runtime.CompilerServices;using System.Threading;namespace OPCtest{ class P

2020-08-31 10:15:10 768

原创 label背景不透明的原因

this.label1.parent = this.picturebox;ok!

2020-08-27 10:09:15 361

原创 字符串分割

public string[] stringCut(string str, int start, int eachLength) { string[] strTemp = null; if (str.Length % eachLength > 0) { strTemp = new string[(str.Length / 200)+1]; }

2020-08-26 14:29:59 125

原创 CRC

/// <summary> /// 字符串转16进制字节数组 /// </summary> /// <param name="hexString"></param> /// <returns></returns> private byte[] strToToHexByte(string hexString)//16进制字符串转换2进制字节数组 ...

2020-08-26 10:52:58 114

原创 子窗口中获取父窗口中控件的值(对象传递)

子窗口中 :public MainWindow myWindow = default; public readHoldingRegWindow(MainWindow window) { InitializeComponent(); this.myWindow = window; }

2020-08-24 13:42:41 510

原创 wpf开发中一次严重的错误!提示子窗体已经绑定父窗体!滥用静态委托!

为了懒,使用了静态委托,直接类名调用;然后我=>>尼玛(!–程序中的委托就一直运行两次,导致子程序内的windows添加到sonwindows的孩子窗口后又再程序内再次赋值添加导致报错(异常:指定的元素已经是另一个元素的逻辑子元素。请先将其断开连接)!–)!!!!!!!静态委托调用的事件处理器会运行两次!!!!!!!改为动态调用后!完全oj8k了 public static Mydele<receivedWindows> ChangeWindowDelegate = de

2020-08-23 22:08:29 150

原创 Modbus写入保持型寄存器类

类(已经过测试) public class Modbus { private SerialPort MySerialPort = null; //received byte arry private byte[] recBytes = new byte[1024]; private byte recByte; public int currentAddr = default;//地址 public

2020-08-22 11:07:12 1881

原创 一个简单的串口发送动态链接库

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.IO.Ports;using Microsoft.SqlServer.Server;namespace SerialPortHelperLib{ /// <summary> /// general serialport

2020-08-18 14:57:57 302

原创 异步编程回调+回调参数

namespace 异步{ public delegate T Mydelegate<T>(ulong x);//异步的本质就是委托 class Program { public static Mydelegate<ulong> mydelegate; public static ulong x; //public static Mydelegate<long> caculateDelegat

2020-08-16 14:23:54 190

原创 委托实现从窗体向主窗体发消息

主窗体namespace WindowsFormsApp12{ public partial class Form1 : Form { public Form1() { InitializeComponent(); Form2 form2 = new Form2(); //多播 form2.mssender += this.getCount;

2020-08-15 13:35:31 121

原创 sql Server 触发器

创建表代码:--if exists(select * from sys.databases where name = 'ProductDB')--drop database ProductDB --go--create database ProductDB--on primary--(--name = 'ProductDB.date',--filename = 'D:\sqlserver\ProductDB.mdf',--size = 10MB,--filegrowth= 4MB--)

2020-08-15 10:52:14 134

原创 Canvas基本布局

<Window x:Class="WpfApp1.Window2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns

2020-08-08 15:44:37 491

原创 WPF基本布局(Grid、StackPanel)

注意:Margin是边距<Window x:Class="WpfApp1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

2020-08-08 15:25:38 519

原创 C#依赖反转去耦合

创建Driver时本来需要一个iAuto对应,sp回去容器里找;由于之前注册了AddScoped(typeof(iAuto),typeof(BWM))所以会自动创建一个BWM的实例传入Driver构造器using System;using System.Collections.Generic;using System.Linq;using System.Runtime.CompilerServices;using System.Text;using System.Threading.Task

2020-08-07 12:52:18 134

原创 c#数据库连接池

SqlConnection sqlConnection = new SqlConnection( "server=192.168.0.103;database=HealthDB;uid =sa;pwd = 666666;" + "pooling = true;max pool size = 10;min pool size = 5"); //最大连接数,最小连接数sqlconnection.open();//

2020-08-05 14:09:01 292

原创 ADO.net读取不到带输出参数的存储过程(问题出在SqlDataReader上)

解决方法是从网络上找到的:MSDN上的明确解释:当您将 Command 对象用于存储过程时,可以将 Command 对象的 CommandType 属性设置为 StoredProcedure。当 CommandType 为 StoredProcedure 时,可以使用 Command 的 Parameters 属性来访问输入及输出参数和返回值。无论调用哪一个 Execute 方法,都可以访问 Parameters 属性。但是,当调用 ExecuteReader 时,在 DataReader 关闭之前,将无

2020-07-31 18:02:40 184

原创 ADO.net一直提示找不到存储过程(胎教级别的错误)

今天复习昨天所学的东西的时候,发现一直报错:throw 找不到存储过程;throw 找不到存储过程;throw 找不到存储过程;throw 找不到存储过程;代码如下:SqlDataReader sqlData = update("exec sp_update_outdate", sqlParameters);蒙的一批左思右想,左想右思,一个小时后恍然大雾,这雾太大了<是什么遮蔽了你的双眼>我居然在执行的代码里加了一个exec ,sql server当场去世;//正确的代码

2020-07-31 17:13:36 272

原创 c#执行带输出参数的存储过程

SqlParameter p1 = new SqlParameter("@value", DbType.Int32); p1.Direction = ParameterDirection.Output; cmd.Parameters.Add(p1); cmd.ExecuteNonQuery();string loancount=cmd.Parameters["@value"].Valu.

2020-07-30 16:56:29 265

原创 ADO.net执行带参数的事务

class Program { static void Main(string[] args) { string sql = "usp_update";//事务 SqlParameter[] sqlParameters = new SqlParameter[]//参数 { new SqlParameter("@inputlow",5), n...

2020-07-30 16:13:45 157

原创 ADO.net执行带参数sql语句

class Program { static void Main(string[] args) { string sql = "select * from Blood_presure where Record_ID>@num"; SqlParameter[] sqlParameters = new SqlParameter[]//创建参数组 { new Sql

2020-07-30 15:37:37 360 1

原创 Dataset的使用及动态过滤dataGridView控件中的数据

dataset的使用及动态过滤dataGridView控件中的数据using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Text;using System.Threading;using System.

2020-07-27 12:12:43 469

ThoughtWorks.QRCode

2020-08-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除