All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
LAMP-Linux+Apache+Mysql+PHP典型配置_php资料_编程技术
ASP.NET,3.5,扩展(预览版)介绍、下载和在线教程_[Asp.Net教程]
SQL语言快速入门之一_mssql学习_编程技术
ASP.NET,2.0中预设的cookie_[Asp.Net教程]
ASP.NET2.0站点跨服务器访问Sql,Sever,2005,Reporting,Service_[Asp.Net教程]
论Asp与XML的关系_[XML教程]
visual c++ MFC的CObject类
C#操作MySQL中文乱码的解决方案_[Asp.Net教程]
C#,IDataReader造成的资源泄漏_.net资料_编程技术
ASP.NET,DataGrid,控件深入研究_[Asp.Net教程]
Reading number is top 10 pictures
BingBingFan apple dew point photo gallery2
NeedWallpaper3
世界五大海盗
Abdominal hit by iron--HangZhou best driver parking save passengers
王艳写真温柔如水2
Go to the national museum2
In the world the most mysterious 21 place landscape4
Photographed the passion of the clients and prostitutes in the sex trade picture2
西游四格漫画(二)
Embarrassing things comic collection1
Download software ranking
都市狐狸姑娘传
Unix video tutorial1
电脑知识及技巧大合集
C#与.NET技术平台实战演练
Desire a peach blossom
Photoshop 8.0图象编辑软件
WebService在.NET中的实战应用教学视频 → 第5集
致我们终将逝去的青春
Unix video tutorial19
Such love down(擒爱记)
aaa published in(发表于) 2013/12/15 8:42:25 Edit(编辑)
C#分析数据库结构,使用XSL模板自动生成代码_.net资料_编程技术

C#分析数据库结构,使用XSL模板自动生成代码_.net资料_编程技术

C#分析数据库结构,使用XSL模板自动生成代码_.net资料_编程技术-你的首页-uuhomepage.com









分析数据库结构,自动生成代码







########################### dbxml.aspx 文件内容,该文件没有C#代码文件 #############




文件 dbxmlcfg.xml内容




--------------------------------------------------------------------------------







Provider=SQLOLEDB.1;Password=123456;Persist Security Info=True;User ID=CPR;Initial Catalog=HTIOA;Data Source=192.168.0.124
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=IssueVision;Data Source=(local)



Select TName ,CName ,coltype ,width From Col where tname in (#tablelist) Order by TName,CName
Select TName ,count(*) From Col group by tname Order by TName
'_default_' and systypes.name<>'sysname' and sysobjects.name in (#tablelist) order by sysobjects.name,syscolumns.name]]>
'_default_' and systypes.name<>'sysname' group by sysobjects.name order by sysobjects.name]]>




####################### main.xml ##################################

http://www.w3.org/1999/XSL/Transform" version="1.0">









模板









选择




表名




字段个数

















































############################### temp_CSharp.xml 内容 ############################################

http://www.w3.org/1999/XSL/Transform" version="1.0">







-------------- 文件名 .cs -----------------------------

 
//-----------------------------------------------------------------------------

///
/// 数据库表 操作对象
/// 编制: 代码生成器
/// 时间:
///

public class Struct : CommonStruct
{ private const string c_TableName ="";
// 定义数据库字段变量 ////////////////////////////////////////////////////////////////



string
int





private m_ ; // 字段




// 定义属性 ///////////////////////////////////////////////////////////



string
int


/// &lt;summary&gt;
/// 设置/返回数据库字段属性
/// &lt;/summary&gt;
/// &lt;returns&gt; &lt;/returns&gt;
public m
{
get{ return m_ ;}
set{ m_ = value ;}
}





new public static string getTableName()
{return c_TableName ;}
new public static string getSelectSQL()
{
return "Select

,
From " + c_TableName ;
}
new public static string getTypeName()
{
return "";
}
new public static string SearchKey(string strKey)
{
return getSelectSQL() + " Where SEQ =" + strKey ;
}
public override bool SetCommandParams( System.Data.OleDb.OleDbCommand myCmd,bool SetValues )
{
if(myCmd!= null)
{
myCmd.Parameters.Clear ();

myCmd.Parameters.Add("",System.Data.OleDb.OleDbType.VarWCharInteger);

if(SetValues)
{

myCmd.Parameters[].Value = m_ ; // 字段

}
return true;
}
return false;
}
public override bool SetInsertCommand( System.Data.OleDb.OleDbCommand myCmd)
{
if(myCmd != null)
{
myCmd.CommandText ="Insert Into " + c_TableName
+ " ( [],
) Values (?,
)";
return this.SetCommandParams(myCmd,true);
}
return false;
}
public override bool SetUpdateCommand(System.Data.OleDb.OleDbCommand myCmd)
{
if(myCmd != null)
{
myCmd.CommandText ="Update " + c_TableName
+ " Set []=? , Where SEQ=" + m_SEQ ;
return this.SetCommandParams(myCmd,true);
}
return false;
}
public override bool SelectRS(System.Data.OleDb.OleDbDataReader myReader)
{
try
{
if(myReader != null)
{
if (myReader.FieldCount==5)
{

m_ = Convert.ToStringInt32(myReader[]);

return true;
}
}
}
catch
{}
return false;
}
public override bool ToXML(System.Xml.XmlElement myElement)
{
if(myElement != null)
{

myElement.SetAttribute("",m_.ToString());

return true;
}
return false;
}
public override bool FromXML(System.Xml.XmlElement myElement)
{
try
{
if(myElement != null)
{

m_ = Convert.ToInt32(myElement.GetAttribute(""));

return true;
}
}
catch
{}
return false;
}
}// 数据库操作类 Struct 定义结束







########################## temp_HTML代码.xml #####################################################

http://www.w3.org/1999/XSL/Transform" version="1.0">








数据表 结构
个字段










字段名




类型




长度












































################################ temp_Java_Struct.xml #######################################################################

http://www.w3.org/1999/XSL/Transform" version="1.0">





-------------- 文件名 .java -----------------------------
 




package com.haitai.emr.struct;
import java.sql.*;
import java.io.*;
/**
* @author 代码生成器 */
public class implements Serializable
{ // 定义数据库字段变量 ////////////////////////////////////////////////////////////////



String
int





private ; // 字段

public static final String SELECT =
"Select

,
From ";
/** @param conn
* @exception SQLException */
public java.sql.PreparedStatement makeInsSt (java.sql.Connection conn) throws SQLException{
PreparedStatement pst=conn.prepareStatement("insert into (

,
)"
+"values(?,)");
int index=0;

pst.setString(++index,this.get()); //

return pst;
}




/** @param conn
* @exception SQLException */
public java.sql.PreparedStatement makeUpdSt (java.sql.Connection conn) throws SQLException{




// TODO : implement
PreparedStatement pst=conn.prepareStatement(
"update set =? ,)"
+"where 数据表关键字段名=?");
int index=0;

pst.setString(++index,this.get()); //




//关键字
pst.setString(++index,this.get数据表关键字段名());//数据表关键字段说明




return pst;
}




public String toString (){




// TODO : implement
return ",="+ + ;
}




// 读取和修改数据的接口



String
int





public get(){
return ;
}
//@param
public void set( value){
= value ;
}

} // 类 定义结束









######################################## temp_VB.xml ############################################################

http://www.w3.org/1999/XSL/Transform" version="1.0">







-------------- 文件名 .cls -----------------------------

 
'******************************************************************************
'**
'** 数据表 [ ]操作的对象
'**
'** 编制:代码生成器
'** 时间:
'**
'******************************************************************************
'** 定义和数据库字段对应的变量 *************************************************************
private const c_TableName As String = "" '** 数据表名称



String
Integer





private m_ As '** 字段




'** 定义数据库字段属性接口 ***************************************************************
Public Property Get TableName() As String
TableName = c_TableName
End Property



String
Integer


'** 数据库字段
Public Property Get m() As
m = m_
End Property
Public Property Let m(Byval Value As )
m_ = m
End Property

'** 获得查询所有数据使用的SQL语句 **
public Function GetBaseSQL() As String
GetBaseSQL ="Select

,
From " & c_TableName
End Function




'** 定义从数据库记录集获得数据的方法 **
Public Function SelectRS(ByVal rs As ADODB.Recordset) As Boolean
On Error GoTo SelectErr
SelectRS = False

m_ = rs.Fields().Value '** 字段

SelectRS = True
Exit Function
SelectErr:
SelectRS = False
End Function















####################### temp_表说明文档.xml ##################################

http://www.w3.org/1999/XSL/Transform
" version="1.0">





-------------表 的说明文档 个字段

 

() .










####################### temp_创建表的SQL语句.xml ##################################

http://www.w3.org/1999/XSL/Transform" version="1.0">





-------------创建表 的SQL语句 个字段

 
CREATE TABLE (




()
,


)








####################### temp_选择表使用的SQL语句.xml ##################################

http://www.w3.org/1999/XSL/Transform" version="1.0">





-------------选择表 的SQL语句 个字段

 
Select


,

From


























添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.