随笔 - 10  文章 - 1  评论 - 2 
  2009年11月15日

create procedure select_procedure(@ID int,@num int output)
as
declare @n int
set @n = 0
select @n = count(*) from Employee where oid=@ID
set @num = @n
return @num
go

 

declare @value int
declare @res int
set @value = 1
execute select_procedure @value,@res output
print @res;

posted @ 2009-11-15 20:53 williamwindy 阅读(16) 评论(0) 编辑
  2009年1月20日

     父窗口:  

      private string strValueA = "";
        public string StrValueA
        {
            get
            {
                return this.strValueA;
            }
            set
            {
                this.strValueA = value;
            }
        }
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.strValueA = this.textBox1.Text;
            Form2 frmchild = new Form2();
            frmchild.Owner = this;
            frmchild.ShowDialog();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.strValueA = this.textBox1.Text;
            Form2 frmchild = new Form2(this.textBox1.Text);
            frmchild.Owner = this;
            string returnValue = "";
            if (frmchild.ShowDialog() == DialogResult.OK)
            {
                // 获取子窗口传回的属性值
                returnValue = frmchild.Str;
                this.textBox1.Text = returnValue;
            }
        }

     子窗口:

 

// 设置它的变量和属性
        private string str;
        public string Str
        {
            get
            {
                return this.str;
            }
            set
            {
                this.str = value;
            }
        }
        // 定义一个父窗口对象
        private Form1 frmparent;

        // 默认构造函数
        public Form2()
        {
            InitializeComponent();
        }
        // 构造函数
        public Form2(string str)
        {
            this.str = str;
            InitializeComponent();
            // 赋文本框为传入的值
            this.textBox1.Text = str;
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            // 将定义的父窗口对象赋值为子窗口所指向的父窗口
            frmparent = (Form1)this.Owner;
            // 同时在文本框中显示父窗口的属性值
            this.textBox1.Text = frmparent.StrValueA;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Str = this.textBox1.Text;
            this.DialogResult = DialogResult.OK;
            // 从子窗口中传数值给父窗口
            // this.Str = "hello";
            this.Close();
        }

posted @ 2009-01-20 17:45 williamwindy 阅读(235) 评论(0) 编辑
  2009年1月19日
[C#]
// 取得当前单元格内容
Console.WriteLine(DataGridView1.CurrentCell.Value);
// 取得当前单元格的列 Index
Console.WriteLine(DataGridView1.CurrentCell.ColumnIndex);
// 取得当前单元格的行 Index
Console.WriteLine(DataGridView1.CurrentCell.RowIndex);
posted @ 2009-01-19 15:15 williamwindy 阅读(63) 评论(0) 编辑

本代码适用于: SQLSERVER2000/2005
SQL语句如下:

select c.name, t.name as type, c.length
  ,(
case t.name
    
when 'nvarchar' then c.length/2
    
when 'nchar' then c.length/2
    
else c.length
  
end)
  
as reallength
from syscolumns c join systypes t
on c.xtype=t.xtype
where t.name <> 'sysname' and c.id=object_id('Table1')

-- 加了这句代码,可以使列按设计时的顺序输出

order by colorder ASC


为了方便使用,可将其封装成一个函数代码如下:

--
--
 返回一个表的列信息
--
 用法:select * from tbl_columns('Table1')
--
 zyl 2007.11.6
--
create function tbl_columns(@tablename nvarchar(256))
returns @tmptb table(
  name 
nvarchar(256),
  type 
varchar(256),
  length 
int,
  reallength 
int
)
begin
insert into @tmptb
select c.name, t.name as type, c.length
  ,(
case t.name
    
when 'nvarchar' then c.length/2
    
when 'nchar' then c.length/2
    
else c.length
  
end)
  
as reallength
from syscolumns c join systypes t
on c.xtype=t.xtype
where t.name <> 'sysname' and c.id=object_id(@tablename)
return 
end
posted @ 2009-01-19 12:00 williamwindy 阅读(518) 评论(1) 编辑
  2009年1月14日
<title>清爽配色15套</title>
<style type="text/css">
.style1{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #96C2F1;
background-color: #EFF7FF
}

.style2{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #9BDF70;
background-color: #F0FBEB
}

.style3{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #BBE1F1;
background-color: #EEFAFF
}

.style4{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #CCEFF5;
background-color: #FAFCFD
}

.style5{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #FFCC00;
background-color: #FFFFF7
}

.style6{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #92B0DD;
background-color: #FFFFFf
}
.style6 h5{
margin: 1px;
background-color: #E2EAF8;
height: 24px;
}

.style7{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #A9C9E2;
background-color: #E8F5FE
}

.style8{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #E3E197;
background-color: #FFFFDD
}

.style9{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #ADCD3C;
background-color: #F2FDDB
}

.style10{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #F8B3D0;
background-color: #FFF5FA
}

.style11{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #D3D3D3;
background-color: #F7F7F7
}

.style12{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #BFD1EB;
background-color: #F3FAFF
}

.style13{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #FFDD99;
background-color: #FFF9ED

.style14{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #CACAFF;
background-color: #F7F7FF

.style15{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #A5B6C8;
background-color: #EEF3F7
}
.style16{
width: 800px;
height: 100px;
margin: 0px auto;
margin-bottom:20px;
border:1px solid #CEE3E9;
background-color: #F1F7F9

</style>

<div class="style1"><h5></h5></div>
<div class="style2"><h5></h5></div>
<div class="style6"><h5></h5></div>
<div class="style3"></div>
<div class="style4"></div>
<div class="style5"></div>
<div class="style7"></div>
<div class="style8"></div>
<div class="style9"></div>
<div class="style10"></div>
<div class="style11"></div>
<div class="style12"></div>
<div class="style13"></div>
<div class="style14"></div>
<div class="style15"></div>
<div class="style16"></div>

posted @ 2009-01-14 19:28 williamwindy 阅读(315) 评论(1) 编辑
  2009年1月10日

我觉得动态生成DataTable在有些需要测试返回Datatable数据集函数
和一些数据绑定控件测试其效果还是挺有用的~

贴码:(

 

Code
posted @ 2009-01-10 10:12 williamwindy 阅读(530) 评论(0) 编辑
  2009年1月6日
posted @ 2009-01-06 23:03 williamwindy 阅读(34) 评论(0) 编辑
posted @ 2009-01-06 15:57 williamwindy 阅读(125) 评论(0) 编辑
  2009年1月4日
posted @ 2009-01-04 15:43 williamwindy 阅读(64) 评论(0) 编辑