自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(63)
  • 资源 (3)
  • 收藏
  • 关注

原创 标准化SQLHelp数据库通用访问类(全)

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Data.SqlClient;using System.Data;using System.Configuration;namespace SQLDB{public class SqlHelp{//链接数据库字符串private stat

2022-01-20 13:51:44 769

原创 T-SQL语句,将主表(A),计划表(B),托工表(C)三个表 进行链接,查询既定单号下的 A表的料号,B表的计划数量,C表的托工数量

通过 sql语句将数据库中的三个表进行Join链接,当查询主表A的料号时,同时带出此料号在B表中的数量和C表中的数量

2023-02-10 15:32:52 528 1

原创 C#限制重复打开窗体的方法

限制C#程序多次打开的,窗体加载的Load事件

2023-01-13 10:40:13 560

原创 SQL查询语句中DISTINCT去重的方法,DISTINCT必须放在第一位

from DZJC_Summary_View where 汇总领料单号 is not null。select DISTINCT(汇总领料单号),车间代码,车间名称,领料单创建日,[创建者]

2022-11-25 10:58:48 673

原创 C# vs判断可执行程序根目录下的某个文件是否存在

try{//检测模板 string moban = objWholeHiveInfo.Muban; string a = System.Windows.Forms.Application.StartupPath + @"\BoxLabels\" + moban; if (File.Exists(a)) {

2022-05-12 13:51:56 400 1

原创 字符数组通过指定字符分割整个字符串

string PF = txt_Ex.Text.Trim();//获取字符串 string[] splits = PF.Split(new string[] { "*" }, StringSplitOptions.RemoveEmptyEntries);//截取字符串【0】品番【1】颗数【2】设变//以* 分割获得的字符串

2022-03-21 14:32:59 244

原创 ListView控件的使用方法,以及数据的绑定(关于会员等级)

private void loadMemberLevelInfo(){try{//加载数据到List<>objMemberLevel = MemberLevelServices.GetMemberlevelInfo();}catch (Exception ex){MessageBox.Show(“获取所有会员级别信息错误,具体原因:” + ex.Message, “系统消息”, MessageBoxButtons.YesNo, MessageBoxIcon.Stop);}/

2022-03-16 15:38:35 679 1

原创 图片转换成文本,和文本转换成图片的方法一级如何调用

using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Runtime.Serialization.Formatters.Binary;using System.Runtime.Serialization;using System.Text;using System.Threading.Tasks;namespace Common{/// /// 用于图片文

2022-03-15 15:06:39 141

原创 ComboBox下拉框控件的数据绑定方法

cmbBookPressName.DataSource = objBookPress;cmbBookPressName.DisplayMember = “PressName”;//显示在下拉框中展示的出版社的名称cmbBookPressName.ValueMember = “PressId”;//获取选中的出版社名称对应的出版社ID cmbBookPressName.SelectedIndex = -1;//当前的索引,打开明细表格的时候所显示的提示字段 cmbBookP

2022-03-12 15:09:43 654

原创 c#读取excel到时报错“未在本地计算机注册Microsoft.ACE.oledb.12.0提供程序”的解决方法

在上传完成Excel的组件以后,还是提示未在本地计算机注册Microsoft.ACE.oledb.12.0提供程序。此时应在项目窗体如图位置更改为 首选32位

2022-03-07 16:59:04 1346

原创 SqlServer判断表中的列重复的值

select * from DH_hwfahuodan_zxwhere item in (select item from DH_hwfahuodan_zx group by item having count(item) > 1)

2022-02-27 11:12:27 385

原创 将DataTable中的数据,根据节点的子父节点的Tag。展示到TreeView树状控件中。

//移除所有分类 tvBookType.Nodes.Clear(); try { dt = BookTypeServices.GetBookType(); } catch (Exception ex) { MessageBox.Show("查询所有图书类别信息错误,具体原因" + ex.Message, "系统消息", MessageBoxButto...

2022-02-22 14:32:26 130

原创 加载DataTable中的数据展示到TreeView树状控件中的方法。

private void LoadBookType(){//定义存储节点信息SortedList objSL = new SortedList();for (int i = 0; i <dt.Rows.Count; i++){if (dt.Rows[i][“TypeId”].ToString()==“1”)//循环遍历Table中类别的ID,如果是1的话 就为根节点。{TreeNode tn = new TreeNode();tn.Text = dt.Rows[i][“TypeNam

2022-02-20 11:20:00 417

原创 将子窗体展示到父窗体Panel中的方法,以及调用的按钮单击事件

private void OpenForm(Form objSubForm)//打开子窗体到父窗体的方法{objSubForm.TopLevel = false;objSubForm.WindowState = FormWindowState.Maximized;objSubForm.FormBorderStyle = FormBorderStyle.None;objSubForm.Parent = splitContainer1.Panel2;objSubForm.Show();}//父窗

2022-02-20 09:04:11 193

原创 T-SQL语句之插入事务的实例

Begin tran --开始事务Begin Try --开始异常捕获insert into Student(SNO, SName, Gender, Birthday, Mobile, Email, HomeAddress)VALUES(950135,‘大猫’,‘男’,‘1995-03-07’,‘13475188187’,‘1@qq.com’,‘山东省德州市’)insert into Student(SNO, SName, Gender, Birthday, Mobile, Email, Home

2022-02-10 13:16:41 626

原创 跨窗体刷新DataGV控件中的数据(次级窗体在修改完成信息后,主窗体在接收到OK指令后直接更新DataGV控件的信息)

//1.主窗体打开添加按钮的单击事件private void btnAdd_Click(object sender, EventArgs e)//添加按钮的单击事件{actionFlag = 2;//更改识别操作的全局变量 //防止关闭明细窗体,再次打开是无响应,需要在明细窗体中将实例化的窗体置为空 if (frmsd == null)//判断窗体是否已经打开 { //将实例化的窗体直接在次级窗体里面创建有参数的方法,直接将参数

2022-02-10 09:51:20 239

原创 添加图片到pictureBox控件中的方法,获取照片路径。

//实例化照片的路径private string photoPath = string.Empty;private void btnAddTo_Click(object sender, EventArgs e)//添加照片的单击事件{ OpenFileDialog openFile = new OpenFileDialog(); openFile.Filter = "图片文件|*.jpg;*.png";//指定图片的文件类型 if (openFile.S

2022-02-09 17:25:45 1234

原创 双击dataGridView控件中的数据行,弹出另一个窗体,并将数据传递到另一个窗体中的方法。实现窗体调用,并数据传输

//实例化学生明细的窗体public static frmStudentDetail frmsd;//主窗体双击单元格的事件private void dgvStudent_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)//双击单元格的事件{//通过Serverice类中的方法得到学生类Student objectStudent = StudentService.GetStudentInfo(Convert.T

2022-02-09 16:52:44 2014

原创 SQL存储过程之更新

—添加存储过程USE TestDBGOif OBJECT_ID(‘UpdataStudent’,‘P’)IS NOT NULLDrop Procedure UpdataStudentgoCreate Procedure UpdataStudent@SN0 INT,@SName CHAR(10),@Gender CHAR(2),@Birthday DATETIME,@Mobile CHAR(20),@Email CHAR(100),@HomeAddress CHAR(100),@P

2022-01-22 15:36:43 1596

原创 SQL存储过程之删除

–创建存储过程USE TestDBGOif OBJECT_ID(‘DeleteStudent’,‘P’)IS NOT NULLDrop Procedure DeleteStudentgoCreate Procedure DeleteStudent@SNO INTASdelete from Student Where SNO=@SNOgo–调用存储过程exec TestDB.dbo.DeleteStudent @SNO=95220...

2022-01-22 09:29:14 1592

原创 SQL存储过程之查询所有信息创建 以及调用

–创建存储过程use TestDBgoif OBJECT_ID(‘GetStudent’,‘P’)IS NOT NULL–判断是否存在存储过程Drop Procedure GetStudent–如果存在则删除goCreate Procedure GetStudent–创建存储过程@SNO INT–查询参数ASSELECT *FROM Student WHERE SNO=@SNOgo–调用exec TestDB.dbo.GetStudent @SNO=95001...

2022-01-22 09:22:38 858

原创 SQL存储过程之Insert插入存储过程的创建以及调用

–创建带有参数的Insert Into的存储过程use TestDBgoif OBJECT_ID(‘InsertStudent’,‘P’) IS NOT NULLDrop Procedure InsertStudentgoCreate Procedure InsertStudent–添加变量–SNO, SName, Gender, Birthday, Mobile, Email, HomeAddress, PhotoPath@SN0 INT,@SName CHAR(10),@Gender

2022-01-22 09:16:31 3799

原创 SQL的存储过程的创建和在C#中调用之查询

//创建查询所有学生信息的存储过程到数据库SQLuse TestDBgoif OBJECT_ID(‘GetStudent’,‘P’) IS Not NullDrop Procedure GetStudentgoCreate Procedure GetStudentASSelect SNO, SName, Gender, Birthday, Mobile, Email, HomeAddress, PhotoPath from StudentGO//查询所有学生信息的存储过程的调用的方法p

2022-01-20 16:56:07 370

原创 SqlParameter[] 数组 sql语句中参数的填充的通用访问类的使用方法

//1.定义通用访问类的方法public static SqlDataReader GetReader(string sql,SqlParameter [] para){//实例化connSqlConnection conn = new SqlConnection(connString);//实例化cmdSqlCommand cmd = new SqlCommand(sql, conn);try{conn.Open();//把参数数组添加到Command对象中cmd.Parameter

2022-01-19 11:08:19 783

原创 使用 SqlCommand.Parameters.AddWithValue填充SQL语句中的参数@SNO。防止SQL攻击

DataSet ds = new DataSet();// 定义查询语句string sql = “SELECT SNO, SName, Gender, Birthday, Mobile, Email, HomeAddress, PhotoPath FROM Student where SNO LIKE @SNO AND SName Like @SName AND Mobile Like @Mobile”;//if (cmbSex.Text.Contains(“女”)){sql += " a

2022-01-19 10:16:42 791

原创 DataSet的Table进行Like的模糊查询方法。

/// /// 使用DataView进行DataSet的表数据模糊查询/// /// DataSet表的名称/// 需要搜索的列的名称/// 需要搜索的列的值/// public static DataView GetVagueSelectInfo(string TableName,string TableColumn, string SelectValue){DataView dv = ds.Tables[TableName].DefaultView;dv.RowFilter = st

2022-01-15 08:35:43 470

原创 SqlCommandBuilder自动更新DataSet到SQLSERVER的使用方法

//实例化connconn = new SqlConnection(connString);//定义SQL查询语句string sql = “SELECT*FROM Student”;//实例化dic通过键值对的方式对表进行赋表名称Dictionary<string, string> dic = new Dictionary<string, string>();dic.Add(“Student”, sql);//循环遍历foreach (KeyValuePair&lt

2022-01-13 17:10:49 243

原创 使用DataAdapter的方法实现DataSet增删改更新同步到SQL

private void LoadStudentInfo()//加载数据到DataSet{//5.实例化connconn = new SqlConnection(connString);//6.使用键值对的方法 对表进行赋值 并查询Dictionary<string, string> dic = new Dictionary<string, string>();//7.定义查询语句string sql = “SELECT*FROM Student”;//8.向泛型集

2022-01-13 13:33:43 282

原创 使用SqlDataAdapter中的TableMappings映射的属性 对DataSet中Table表进行初始化表名称

/ //实例化conn// SqlConnection conn = new SqlConnection(connString);// //定义查询语句// string sql = “SELECT*FROM Student;SELECT *FROM Course”;// //实例化cmd// SqlCommand cmd = new SqlCommand(sql, conn);// //实例化DataAdapter// SqlDataAdapt

2022-01-12 15:33:35 172

原创 通过 Dictionary<string, string>泛型集合键值对的方法对DataSet多表查询的时候 为Table进行初始化表名称(赋表名称)

定义链接数据库字符串 string connString="SERVER= ;UID= ;PWD= ;DataBase= "; //实例化conn SqlConnection conn = new SqlConnection(connString); //通过泛型集合定义查询语句 并对表赋表名称 Dictionary<string, string> dic = new Dictionary&...

2022-01-12 15:31:43 215

原创 正则表达式验证的几种方法

public static class Verification{public static bool IsNumber(string txt)//判断是不是数字{Regex objRegex = new Regex(@"1*KaTeX parse error: Expected 'EOF', got '}' at position 56: …txt); }̲ public…");return regex.IsMatch(txt);}public static

2021-12-15 08:15:42 1090

原创 解决SQL两个不同服务器地址的数据库互相链接查询

select * from OPENDATASOURCE(‘SQLOLEDB’,‘Data Source=服务器IP;User ID=sa;Password=密码’).数据库名.dbo.表名运行上面查询语句出现这样的错误的时候的解决方法:消息 15281,级别 16,状态 1,第 1 行 SQL Server 阻止了对组件“Ad Hoc Distributed Queries”的 STATEMENT“OpenRowset/OpenDaexec sp_configure ‘show advanced op

2021-10-19 15:40:00 967

原创 C#获取CPU信息的方法

private string GetInfo(){this.cpuInfo = “”;ManagementClass class2 = new ManagementClass(“Win32_Processor”);foreach (ManagementObject obj2 in class2.GetInstances()){this.cpuInfo = obj2.Properties[“ProcessorId”].Value.ToString();}return this.cpuInfo;

2021-10-05 13:51:31 861

原创 C#调用CodeSoft打印

private void btPrint_Click(object sender, EventArgs e){PrintBoxLabel(“2021”, “pinfan”, “shebian”, “批号”,“颗数”, “2015152525”,10);}private void PrintBoxLabel(string date, string pinfan, string shebian, string pihao, string keshu, string barcode, int copies

2021-09-29 13:06:18 1292

原创 C#引用CS7标签软件 提示LabelManager2.ApplicationClass 无法嵌入互操作类型

LabelManager2中的嵌入互操作类型的属性改为False

2021-09-28 16:13:29 793

原创 C#将DataSet内存数据库中执行了增删改后 更新到SQL

///SQLHelper类库中的方法public static void UpdateDataSetToKey(Dictionary<string,string> dic)//通过键值对的方法{try{connDataSet.Open();foreach (KeyValuePair<string, string> item in dic){sda.Update(ds, item.Key);}}catch (Exception ex){

2021-09-28 09:47:23 364

原创 C#常用的正则表达式的几种用法

public class Verification{public static bool IsNumber(string txt)//判断是不是数字{Regex objRegex = new Regex(@"1KaTeX parse error: Expected 'EOF', got '}' at position 55: …(txt); }̲ public…");return regex.IsMatch(txt);}public static bool I

2021-09-27 14:42:20 66

原创 C#在DataSet内存数据库中执行查询

private void txtSelectName_TextChanged(object sender, EventArgs e)//TextBox文本发生改变的事件根据姓名查询的方法 { DataView dv = ds.Tables["Student"].DefaultView; dv.RowFilter = "SName Like '%" + txtSelectName.Text + "%'"; dgvStudent.DataSource ..

2021-09-27 14:29:31 495

原创 C#链接模型和非连接模型下的集中方法<SqlHelper>

//定义链接数据库字符串 private static string connString = ConfigurationManager.ConnectionStrings["connString"].ToString(); //====================================链接模式下的三中数据库链接类型======================================== /// <summary> /// 读取所有行的信息 .

2021-09-25 17:24:15 69

原创 c#将读取到的Excel文件的添加到DataTable,循环遍历DataTable 将Table的数据依次写入到List<T>中。然后展示到DatAGV控件中

string FilePath = string.Empty;public static DataTable ImportExcelToDataTable2(string path){ string conStr = string.Format("Provider=Microsoft.ACE.OLEDB.12.0; Data source={0}; Extended Properties=Excel 12.0;", path); using (OleDbConnectio

2021-09-24 13:15:26 646

关于利用SQL事务来管理学生的借书系统,含完整的SQLHelp数据通用访问类以及数据库备份

关于利用SQL事务来管理学生的借书系统,含完整的SQLHelp数据通用访问类以及数据库备份

2022-02-12

DotNetBar条码打印.7z

sideBarPanelItem1 简单的框架应用

2021-09-29

C#上传Excel所需的 Microsoft.Office.Interop.Excel引用

C#上传Excel所需的 Microsoft.Office.Interop.Excel引用

2021-09-23

空空如也

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

TA关注的人

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