首页 >> 民生理财

通过操作数据的模块

民生理财  2021-08-24 13:34 字号: 大 中 小

// 本程序提供了一个通过HTTP来操作数据库的类,这样少了本地安装乱七八糟的数据库驱动程序及复杂的设置,

// Web 服务器可以是任意的类型的,可以为 ASP , JSP 或其他,本模块提供了服务器的 的

// 例子

// 南京千里独行原创 请引用时勿删除本行

using System;

using ;

namespace myConnection

{

///

/// XMLHttp数据库连接操作事件处理委托

///

/// 数据库连接对象

/// 数据库命令对象

/// 总的数据字节数

/// 已完成的数据字节数

public delegate void XMLHttpDBExecutingHandler( XMLHttpConnection conn , XMLHttpCommand cmd , long ContentLength , long ContentCompleted );

///

/// XMLHttp类型的数据库数据读取对象

///

public class XMLHttpReader : ataReader

{

private string[] strHead = null;

private rayList myRows = new rayList();

private bool bolClosed = false;

private int intRowIndex = 0 ;

private const string c_NullFlag = \"[NULL]\" ;

///

/// 根据字段名称获得字段序号,比较不区分大小写

///

/// 字段名称

/// 字段的从0开始的序号,若没找到则返回-1

public int GetIndexByName( string strName )

{

if( strName == null ) return -1 ;

strName = Upper().Trim();

for( int iCount = 0 ; iCount ngth ; iCount ++ )

if( uals( strHead[iCount]))

return iCount ;

return -1 ;

}

///

/// 从一个数据库读取对象加载对象数据

///

/// 数据库数据读取对象

/// 加载的记录的行数

public int FromReader(ataReader myReader)

{

if( myReader != null)

{

// 加载列头信息

strHead = new string[ eldCount ];

for( int iCount = 0 ; iCount eldCount ; iCount ++ )

strHead[iCount] = tName(iCount).ToLower().Trim();

// 加载数据

ear();

intRowIndex = -1 ;

while( ad())

{

string[] strValues = new string[ eldCount];

d( strValues );

for( int iCount = 0 ; iCount eldCount ;iCount ++ )

{

if( DBNull( iCount ) == false)

{

if( myReader[iCount] is byte[])

{

strValues[iCount] = Base64String( (byte[])myReader[iCount]);

}

else

strValues[iCount] = myReader[iCount].ToString();

}

}// for

}// while

return unt ;

}// if

return -1;

}// FromReader

///

/// 保存对象数据到XML节点

///

/// 根XML节点

/// 保存的记录个数

public int ToXML( LElement RootElement )

{

LElement RowElement = null;

LElement FieldElement = null;

while( rstChild != null)

moveChild( rstChild);

// 保存列数据

if( strHead != null ngth 0 )

{

for( int iCount = 0 ; iCount ngth ;iCount ++ )

{

tAttribute(\"f\" + String() , strHead[iCount]);

}

发现保洁员焚烧垃圾 tAttribute(\"fieldcount\" , String());

}

查看本文来源

吉林治疗白癜风医院
合肥治白癜风去哪里
石家庄白癜风治疗医院
推荐资讯