通过操作数据的模块
民生理财 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());
}
查看本文来源
吉林治疗白癜风医院合肥治白癜风去哪里
石家庄白癜风治疗医院
-
-
天津女排踏上复兴之路阵容重组陈丽怡仍是中
天津女排踏上复兴之路 阵容重组陈丽怡仍是中坚天津女排夺冠...
2020-07-07 | 民生理财
-
-
专家房产税征收受到九成以上政府官员阻挠搭配
专家:房产税征收受到九成以上政府官员阻挠 “要搞好房地产...
2020-06-06 | 民生理财
-
-
海南西环高速铁路正式试运行和谐号动车疾驰搭配
海南西环高速铁路正式试运行 和谐号动车疾驰前进 11月26日,...
2020-06-02 | 民生理财
-
-
北京市机动车停车条例搭配
北京市机动车停车条例(2018年3月30日北京市第十五届人民代表...
2020-05-31 | 民生理财
-
-
决胜局独揽分李盈莹表现出彩担任接应效果不搭配
决胜局独揽分李盈莹表现出彩 担任接应效果不佳李盈莹中国女...
2020-05-30 | 民生理财
-
-
特评从C罗到彩票佛爷的任性主帅为他背锅搭配
特评:从C罗到彩票!佛爷的任性 主帅为他背锅原标题:特评...
2020-05-29 | 民生理财