利用Sql脚本生成C#类

 /*
 * 作者:   evlon(阿牛) MSN:niukl@msn.com  QQ:273352165
 * 功能:   得用Sql生成的脚本生成C#类
 */

对于Sql Server数据库,有查询分析器的帮助.我们可以省下不少的工夫.

如果,在查询分析器的
选项.脚本中,勾选"将扩展属性脚本作为对象脚本的一部分"
我们可以生成如下的Create 脚本:
None.gifCREATE TABLE [AdminUsers] (
None.gif    
[userid] [int] IDENTITY (11NOT NULL ,
None.gif    
[loginID] [varchar] (30) COLLATE Chinese_PRC_CI_AS NOT NULL ,
None.gif    
[loginPwd] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
None.gif    
[UserName] [nvarchar] (30) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF_AdminUsers_UserName] DEFAULT (''),
None.gif    
[IsSuperMan] [bit] NOT NULL CONSTRAINT [DF_AdminUsers_IsSuperMan] DEFAULT (0),
None.gif    
CONSTRAINT [PK_AdminUsers] PRIMARY KEY  CLUSTERED 
None.gif    (
None.gif        
[userid]
None.gif    )  
ON [PRIMARY] 
None.gif
ON [PRIMARY]
None.gif
GO
None.gif
None.gif
None.gif
exec sp_addextendedproperty N'MS_Description', N'是否超级用户', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'IsSuperMan'
None.gif
GO
None.gif
exec sp_addextendedproperty N'MS_Description', N'登陆名', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'loginID'
None.gif
GO
None.gif
exec sp_addextendedproperty N'MS_Description', N'登陆密码', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'loginPwd'
None.gif
GO
None.gif
exec sp_addextendedproperty N'MS_Description', N'用户系统标识', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'userid'
None.gif
GO
None.gif
exec sp_addextendedproperty N'MS_Description', N'真实姓名', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'UserName'
None.gif
None.gif
None.gif
GO
None.gif

我们要生成下面的C#类:
ExpandedBlockStart.gifContractedBlock.gif/**//// <summary>
InBlock.gif
/// AdminUsers的摘要说明。
ExpandedBlockEnd.gif
/// </summary>

None.gifpublic class AdminUsers
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
ExpandedSubBlockEnd.gif    
/// 用户系统标识/// </summary>

InBlock.gif    private int userid;
InBlock.gif    
public int Userid
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
getdot.gifreturn userid; }
ExpandedSubBlockStart.gifContractedSubBlock.gif        
setdot.gif{ userid = value; }
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
ExpandedSubBlockEnd.gif    
/// 登陆名/// </summary>

InBlock.gif    private string loginID;
InBlock.gif    
public string LoginID
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
getdot.gifreturn loginID; }
ExpandedSubBlockStart.gifContractedSubBlock.gif        
setdot.gif{ loginID = value; }
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
ExpandedSubBlockEnd.gif    
/// 登陆密码/// </summary>

InBlock.gif    private string loginPwd;
InBlock.gif    
public string LoginPwd
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
getdot.gifreturn loginPwd; }
ExpandedSubBlockStart.gifContractedSubBlock.gif        
setdot.gif{ loginPwd = value; }
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
ExpandedSubBlockEnd.gif    
/// 真实姓名/// </summary>

InBlock.gif    private string userName;
InBlock.gif    
public string UserName
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
getdot.gifreturn userName; }
ExpandedSubBlockStart.gifContractedSubBlock.gif        
setdot.gif{ userName = value; }
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
ExpandedSubBlockEnd.gif    
/// 是否超级用户/// </summary>

InBlock.gif    private bool isSuperMan;
InBlock.gif    
public bool IsSuperMan
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
getdot.gifreturn isSuperMan; }
ExpandedSubBlockStart.gifContractedSubBlock.gif        
setdot.gif{ isSuperMan = value; }
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

      由于Sql脚本中有我们需要的所有的东西.我们就有了生成类的必要条件.我已经把它用Javascript脚本实现了:

None.gif<html>
None.gif
<head>
None.gif    
<title>Untitled</title>
ExpandedBlockStart.gifContractedBlock.gif
<script language=javascript>dot.gif
InBlock.gif    String.prototype.upperFirstChar 
= function()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
return this.replace(/^(\w)/,function($1)dot.gif{return $1.toUpperCase();});
ExpandedSubBlockEnd.gif    }

InBlock.gif    
InBlock.gif    String.prototype.lowerFirstChar 
= function()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
return this.replace(/^(\w)/,function($1)dot.gif{return $1.toLowerCase();});
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var ConvertDbTypeToCSType = dot.gif{
InBlock.gif                    
"bigint":"long",
InBlock.gif                    
"binary":"byte[]",
InBlock.gif                    
"bit":"bool",
InBlock.gif                    
"char":"char",
InBlock.gif                    
"datetime":"DateTime",
InBlock.gif                    
"decimal":"decimal",
InBlock.gif                    
"float":"float",
InBlock.gif                    
"image":"byte[]",
InBlock.gif                    
"int":"int",
InBlock.gif                    
"money":"string",
InBlock.gif                    
"nchar":"char",
InBlock.gif                    
"ntext":"string",
InBlock.gif                    
"numeric":"int",
InBlock.gif                    
"nvarchar":"string",
InBlock.gif                    
"real":"string",
InBlock.gif                    
"smalldatetime":"DateTime",
InBlock.gif                    
"smallint":"int",
InBlock.gif                    
"smallmoney":"string",
InBlock.gif                    
"sql_variant":"string",
InBlock.gif                    
"sysname":"string",
InBlock.gif                    
"text":"string",
InBlock.gif                    
"timestamp":"DateTime",
InBlock.gif                    
"tinyint":"int",
InBlock.gif                    
"uniqueidentifier":"string",
InBlock.gif                    
"varbinary":"byte[]",
InBlock.gif                    
"varchar":"string"
ExpandedSubBlockEnd.gif                    }
;
InBlock.gif    
function CsFileStream()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
this.ms = new Array();
InBlock.gif        
this.tabNum = 0;
InBlock.gif        
InBlock.gif        
this.getTabs = function()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
var arr = new Array();
InBlock.gif            arr.length 
= this.tabNum + 1;
InBlock.gif            
return arr.join("\t");
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    
InBlock.gif    CsFileStream.prototype.append 
= function()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
var str =  arguments[0];
InBlock.gif        
if(str instanceof Array)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            str 
= str.join("");
ExpandedSubBlockEnd.gif        }

InBlock.gif        
if(this.tabNum > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
var tabs = this.getTabs();
InBlock.gif            
var tmpStr = str.replace(/\n/g,"\n" + tabs);
InBlock.gif            
this.ms[this.ms.length] = tmpStr;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.ms[this.ms.length] = str;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    
InBlock.gif    CsFileStream.prototype.addTab 
= function()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
this.tabNum ++;
InBlock.gif        
if(this.ms.length > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.ms[this.ms.length - 1= this.ms[this.ms.length - 1].replace(/\n\t*$/gm,'\n' +  this.getTabs());
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }
    
InBlock.gif    
InBlock.gif    CsFileStream.prototype.delTab 
= function()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
this.tabNum --;
InBlock.gif        
if(this.ms.length > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.ms[this.ms.length - 1= this.ms[this.ms.length - 1].replace(/\n\t*$/gm, '\n' +  this.getTabs());
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }
    
InBlock.gif
InBlock.gif    CsFileStream.prototype.toString 
= function()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
return this.ms.join("");
ExpandedSubBlockEnd.gif    }
    
InBlock.gif    
InBlock.gif    
function buildCsFromSql(strSql)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
var tableName = strSql.match(/table\s+\[([^\]]+)\]/i)[1];
InBlock.gif        
var column = [];
InBlock.gif        
var rgx = /\[([^\]]+)\]\s+\[([^\]]+)\]/gi;
InBlock.gif        
var arr;
InBlock.gif        
while((arr = rgx.exec(strSql)) != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            column[arr[
1]] = dot.gif{};
InBlock.gif            column[arr[
1]].name=arr[1];
InBlock.gif            column[arr[
1]].dbtype=arr[2];
InBlock.gif            column[arr[
1]].cstype=ConvertDbTypeToCSType[arr[2]];
ExpandedSubBlockEnd.gif        }

InBlock.gif        
InBlock.gif        rgx 
= /N'MS_Description',\s+N'([^']+)'.+N'([^']+)'$/gim;
InBlock.gif        
while((arr = rgx.exec(strSql)) != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            column[arr[
2]].dbdesc=arr[1];
ExpandedSubBlockEnd.gif        }

InBlock.gif        
InBlock.gif        
var cs = new CsFileStream();
InBlock.gif        cs.append(
"/// <summary>\n");
InBlock.gif        cs.append([
"/// ",tableName.upperFirstChar(),"的摘要说明。\n"]);
InBlock.gif        cs.append(
"/// </summary>\n");
InBlock.gif        cs.append([
"public class ",tableName.upperFirstChar(),"\n"]);
InBlock.gif        cs.append(
"{\n");
InBlock.gif        cs.addTab();
InBlock.gif        
for(var i in column)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//私有成员
InBlock.gif
            cs.append("/// <summary>\n");
InBlock.gif            cs.append([
"/// ",column[i].dbdesc]);
InBlock.gif            cs.append(
"/// </summary>\n");
InBlock.gif            cs.append([
"private ",column[i].cstype," ", column[i].name.lowerFirstChar(),";\n"]);
InBlock.gif            cs.append([
"public ",column[i].cstype," ", column[i].name.upperFirstChar(),"\n"]);
InBlock.gif            cs.append(
"{\n");
InBlock.gif            cs.addTab();
InBlock.gif            cs.append([
"get{ return ",column[i].name.lowerFirstChar(),"; }\n"]);
InBlock.gif            cs.append([
"set{ ",column[i].name.lowerFirstChar()," = value; }\n"]);
InBlock.gif            cs.delTab();
InBlock.gif            cs.append(
"}\n");
ExpandedSubBlockEnd.gif        }

InBlock.gif        cs.delTab();
InBlock.gif        cs.append(
"}\n");
InBlock.gif        
InBlock.gif         
return cs.toString();
InBlock.gif
ExpandedSubBlockEnd.gif    }

InBlock.gif    
InBlock.gif    
function go_buildCsFromSql()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        txtCs.value 
= buildCsFromSql(txtSql.value);
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif    
None.gif
</script>
None.gif
None.gif
</head>
None.gif
None.gif
<body>
None.gif
<textarea id=txtSql style="width:100%;height:400px;">
None.gifCREATE TABLE [AdminUsers] (
None.gif    [userid] [int] IDENTITY (1, 1) NOT NULL ,
None.gif    [loginID] [varchar] (30) COLLATE Chinese_PRC_CI_AS NOT NULL ,
None.gif    [loginPwd] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
None.gif    [UserName] [nvarchar] (30) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF_AdminUsers_UserName] DEFAULT (''),
None.gif    [IsSuperMan] [bit] NOT NULL CONSTRAINT [DF_AdminUsers_IsSuperMan] DEFAULT (0),
None.gif    CONSTRAINT [PK_AdminUsers] PRIMARY KEY  CLUSTERED 
None.gif    (
None.gif        [userid]
None.gif    )  ON [PRIMARY] 
None.gif) ON [PRIMARY]
None.gifGO
None.gif
None.gif
None.gifexec sp_addextendedproperty N'MS_Description', N'是否超级用户', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'IsSuperMan'
None.gifGO
None.gifexec sp_addextendedproperty N'MS_Description', N'登陆名', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'loginID'
None.gifGO
None.gifexec sp_addextendedproperty N'MS_Description', N'登陆密码', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'loginPwd'
None.gifGO
None.gifexec sp_addextendedproperty N'MS_Description', N'用户系统标识', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'userid'
None.gifGO
None.gifexec sp_addextendedproperty N'MS_Description', N'真实姓名', N'user', N'dbo', N'table', N'AdminUsers', N'column', N'UserName'
None.gif
None.gif
None.gifGO
None.gif
</textarea>
None.gif
<input type="button" value="生成" id="doit" onclick="go_buildCsFromSql()">
None.gif
<textarea id=txtCs style="width:100%;height:400px;">
None.gif
</textarea>
None.gif
None.gif
</body>
None.gif
</html>
None.gif
运行效果如下:
ConvertSql2CSharp.JPG

还可以改成Emeditor宏:记得保存
None.gif    String.prototype.upperFirstChar = function()
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
return this.replace(/^(\w)/,function($1)dot.gif{return $1.toUpperCase();});
ExpandedBlockEnd.gif    }

None.gif    
None.gif    String.prototype.lowerFirstChar 
= function()
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
return this.replace(/^(\w)/,function($1)dot.gif{return $1.toLowerCase();});
ExpandedBlockEnd.gif    }

None.gif
ExpandedBlockStart.gifContractedBlock.gif    
var ConvertDbTypeToCSType = dot.gif{
InBlock.gif                    
"bigint":"long",
InBlock.gif                    
"binary":"byte[]",
InBlock.gif                    
"bit":"bool",
InBlock.gif                    
"char":"char",
InBlock.gif                    
"datetime":"DateTime",
InBlock.gif                    
"decimal":"decimal",
InBlock.gif                    
"float":"float",
InBlock.gif                    
"image":"byte[]",
InBlock.gif                    
"int":"int",
InBlock.gif                    
"money":"string",
InBlock.gif                    
"nchar":"char",
InBlock.gif                    
"ntext":"string",
InBlock.gif                    
"numeric":"int",
InBlock.gif                    
"nvarchar":"string",
InBlock.gif                    
"real":"string",
InBlock.gif                    
"smalldatetime":"DateTime",
InBlock.gif                    
"smallint":"int",
InBlock.gif                    
"smallmoney":"string",
InBlock.gif                    
"sql_variant":"string",
InBlock.gif                    
"sysname":"string",
InBlock.gif                    
"text":"string",
InBlock.gif                    
"timestamp":"DateTime",
InBlock.gif                    
"tinyint":"int",
InBlock.gif                    
"uniqueidentifier":"string",
InBlock.gif                    
"varbinary":"byte[]",
InBlock.gif                    
"varchar":"string"
ExpandedBlockEnd.gif                    }
;
None.gif    
function CsFileStream()
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        
this.ms = new Array();
InBlock.gif        
this.tabNum = 0;
InBlock.gif        
InBlock.gif        
this.getTabs = function()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
var arr = new Array();
InBlock.gif            arr.length 
= this.tabNum + 1;
InBlock.gif            
return arr.join("\t");
ExpandedSubBlockEnd.gif        }

ExpandedBlockEnd.gif    }

None.gif    
None.gif    CsFileStream.prototype.append 
= function()
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        
var str =  arguments[0];
InBlock.gif        
if(str instanceof Array)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            str 
= str.join("");
ExpandedSubBlockEnd.gif        }

InBlock.gif        
if(this.tabNum > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
var tabs = this.getTabs();
InBlock.gif            
var tmpStr = str.replace(/\n/g,"\n" + tabs);
InBlock.gif            
this.ms[this.ms.length] = tmpStr;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.ms[this.ms.length] = str;
ExpandedSubBlockEnd.gif        }

ExpandedBlockEnd.gif    }

None.gif    
None.gif    CsFileStream.prototype.addTab 
= function()
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        
this.tabNum ++;
InBlock.gif        
if(this.ms.length > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.ms[this.ms.length - 1= this.ms[this.ms.length - 1].replace(/\n\t*$/gm,'\n' +  this.getTabs());
ExpandedSubBlockEnd.gif        }

ExpandedBlockEnd.gif    }
    
None.gif    
None.gif    CsFileStream.prototype.delTab 
= function()
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        
this.tabNum --;
InBlock.gif        
if(this.ms.length > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.ms[this.ms.length - 1= this.ms[this.ms.length - 1].replace(/\n\t*$/gm, '\n' +  this.getTabs());
ExpandedSubBlockEnd.gif        }

ExpandedBlockEnd.gif    }
    
None.gif
None.gif    CsFileStream.prototype.toString 
= function()
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        
return this.ms.join("");
ExpandedBlockEnd.gif    }
    
None.gif    
None.gif    
function buildCsFromSql(strSql)
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        
var tableName = strSql.match(/table\s+\[([^\]]+)\]/i)[1];
InBlock.gif        
var column = [];
InBlock.gif        
var rgx = /\[([^\]]+)\]\s+\[([^\]]+)\]/gi;
InBlock.gif        
var arr;
InBlock.gif        
while((arr = rgx.exec(strSql)) != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            column[arr[
1]] = dot.gif{};
InBlock.gif            column[arr[
1]].name=arr[1];
InBlock.gif            column[arr[
1]].dbtype=arr[2];
InBlock.gif            column[arr[
1]].cstype=ConvertDbTypeToCSType[arr[2]];
ExpandedSubBlockEnd.gif        }

InBlock.gif        
InBlock.gif        rgx 
= /N'MS_Description',\s+N'([^']+)'.+N'([^']+)'$/gim;
InBlock.gif        
while((arr = rgx.exec(strSql)) != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            column[arr[
2]].dbdesc=arr[1];
ExpandedSubBlockEnd.gif        }

InBlock.gif        
InBlock.gif        
var cs = new CsFileStream();
InBlock.gif        cs.append(
"/// <summary>\n");
InBlock.gif        cs.append([
"/// ",tableName.upperFirstChar(),"的摘要说明。\n"]);
InBlock.gif        cs.append(
"/// </summary>\n");
InBlock.gif        cs.append([
"public class ",tableName.upperFirstChar(),"\n"]);
InBlock.gif        cs.append(
"{\n");
InBlock.gif        cs.addTab();
InBlock.gif        
for(var i in column)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//私有成员
InBlock.gif
            cs.append("/// <summary>\n");
InBlock.gif            cs.append([
"/// ",column[i].dbdesc]);
InBlock.gif            cs.append(
"/// </summary>\n");
InBlock.gif            cs.append([
"private ",column[i].cstype," ", column[i].name.lowerFirstChar(),";\n"]);
InBlock.gif            cs.append([
"public ",column[i].cstype," ", column[i].name.upperFirstChar(),"\n"]);
InBlock.gif            cs.append(
"{\n");
InBlock.gif            cs.addTab();
InBlock.gif            cs.append([
"get{ return ",column[i].name.lowerFirstChar(),"; }\n"]);
InBlock.gif            cs.append([
"set{ ",column[i].name.lowerFirstChar()," = value; }\n"]);
InBlock.gif            cs.delTab();
InBlock.gif            cs.append(
"}\n");
ExpandedSubBlockEnd.gif        }

InBlock.gif        cs.delTab();
InBlock.gif        cs.append(
"}\n");
InBlock.gif        
InBlock.gif         
return cs.toString();
InBlock.gif
ExpandedBlockEnd.gif    }

None.gif    
None.gif    
function go_buildCsFromSql()
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        txtCs.value 
= buildCsFromSql(txtSql.value);
ExpandedBlockEnd.gif    }

None.gif    
try
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        document.selection.SelectAll();
InBlock.gif        document.selection.Text 
= buildCsFromSql(document.selection.Text);
InBlock.gif        document.selection.Collapse();
InBlock.gif        
InBlock.gif        document.ConfigName 
= "C#";
ExpandedBlockEnd.gif    }

None.gif    
catch(e)
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        alert(
"Sql的格式不正确");
ExpandedBlockEnd.gif    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值