19
2012
07

存储过程模拟加锁解锁


-- 获取锁

ALTER procedure [dbo].[pro_get_sys_ordr_lock_info](   

     @ORDR_HEAD_SEQ 编号,  

     @ORDR_TYP_CD VARCHAR(20)  

 )as  

begin   

19
2012
07

将DataGridViewRows转换为DataTable数据


.Net WinForm代码:

        /// <summary>
        /// 将DataGridViewRows转换为DataTable数据
        /// </summary>
        /// <param name="Listrows">DataGridView的行集合</param>
        /// <param name="dtSource">源数据表</param>
        /// <param name="colum">映射关系</param>
        /// <param name="dtDestination">目的数据表</param>
        /// <returns>返回新的DataTable</returns>
        public static DataTable Getdatatable(DataGridViewRowCollection Listrows, DataTable dtSource, string[,] colum, DataTable dtDestination)
        {
            //  string[,] colum = { { "id1", "id2" }, { "name1", "name2" } };  //colum是源DataGridViewRow到目标DataRow的映射关系
            DataTable dtNew = dtSource.Clone();//复制表结构
            foreach (DataGridViewRow dgvr in Listrows)
            {
                DataRow dataRow = (dgvr.DataBoundItem as DataRowView).Row;  //转换成数据行DataRow
                dtNew.ImportRow(dataRow);  //添加DataRow到DataTable
            }
            string[] copy = new string[colum.Length / 2];
            for (int i = 0; i < colum.Length / 2; i++)
            {
                copy[i] = colum[i, 0];  //获取源数据要的列
            }
            DataTable dtNew2 = dtNew.DefaultView.ToTable(false, copy);//复制源表结构和数据,并只保留copy数据中的列
            if (dtDestination != null)
            {
                for (int j = 0; j < dtNew2.Rows.Count; j++)
                {
                    DataRow row = dtDestination.NewRow();
                    for (int f = 0; f < colum.Length / 2; f++)
                    {
                        row[colum[f, 1]] = dtNew2.Rows[j][colum[f, 0]]; //将源表中每行的各列数据复制到对应的目的表的行中
                    }
                    dtDestination.Rows.Add(row); //添加到目的表
                }
            }
            return dtDestination;
        }


18
2012
07

存储过程用例--新增、修改、删除数据


set ANSI_NULLS ON  

set QUOTED_IDENTIFIER ON  

go  

/*****************************************************  

** PROCEDURE : pro_set_so_cust_info  

** DECRIPTION: 维护客户资料信息  

18
2012
07

存储过程样例--获取数据

set ANSI_NULLS ON  

set QUOTED_IDENTIFIER ON  

go  

  

/*****************************************************  

** PROCEDURE : pro_get_so_cust_list  

** DECRIPTION: 获取客户列表  

18
2012
07

mssql存储过程样例--判断是否存在

set ANSI_NULLS ON  

set QUOTED_IDENTIFIER ON  

go  

/*****************************************************  

** PROCEDURE : pro_is_so_cust_nam_show_repeat  

** DECRIPTION: 判断客户用户和或显示名称是否重复  

18
2012
07

c#winform中,对DataGridView数据进行操作,一次性保存

需求:不能每加一条数据就操作数据库,要完成所有的数据加入界面,点击保存时才一次性保存。

12
2012
07

c#中程序最小化到托盘

拖一个 notifyIcon控件到界面,名为 notifyIcon1


03
2012
07

c#删除移动硬盘中$RECYCLE.BIN的文件、建立索引文件

软件界面:


24
2012
06

[转载]C#多线程BackgroundWorker使用示例

.Net WinForm Code:


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.Threading;
namespace BackgroundWorkerSample
{
    public partial class CalculateAddForm : Form
    {
        protected BackgroundWorker backgroundWorker1 = new BackgroundWorker();
        //private int numberToCompute = 0;
        //private int highestPercentageReached = 0;
        public CalculateAddForm()
        {
            InitializeComponent();
            InitializeBackgoundWorker();
           
        }
        // Set up the BackgroundWorker object by
        // attaching event handlers.
        private void InitializeBackgoundWorker()
        {
            this.backgroundWorker1.WorkerReportsProgress = true;
            this.backgroundWorker1.WorkerSupportsCancellation = true;
           
            this.backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
            this.backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
            this.backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
        }
        private long ComputeAdd(int n, BackgroundWorker worker, DoWorkEventArgs e)


23
2012
06

jquery插件printArea打印、corner圆角

 

<div id="testdiv" class="demo" style="width:200px;height:150px;border-width:1px;border-style:solid;border-color:Blue;">
...