.net中XML文件作为数据源的操作类
不解释了,自己看代码吧.......................
using System;
using System.Text;
using System.Data;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Xml;
namespace Gogofly.CommonOperation
{
/// <summary>
/// 数据类型转换
/// </summary>
public class DataTypeConvert
{
#region 数据类型转换
public DataTypeConvert(){}
/// <summary>
/// 字符串转换为整数
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static int ConvertToInt(string value)
{ ///数据为空,返回-1
if(string.IsNullOrEmpty(value))return -1;
int result = -1;
///执行转换操作
Int32.TryParse(value,out result);
return result;
}
/// <summary>
/// 字符串转换为时间
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static DateTime ConvertToDateTime(string value)
{ ///定义初始化值
DateTime result = DateTime.Parse("1900-01-01");
if(string.IsNullOrEmpty(value)) return result;
///执行转换操作
DateTime.TryParse(value,out result);
return result;
}
/// <summary>
/// 字符串转换为实数
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static decimal ConvertToDecimal(string value)
{ ///定义初始化值
decimal result = 0.0M;
if(string.IsNullOrEmpt
相关文档:
Paul.Todd | 09 April, 2007 15:24
I have noticed a couple of people seem to be having problems with using the XML parser in Symbian and there are no examples outside of the devkit. The parser I will be talking about is the xml one, not the one SOAP engine as the SOAP one is Nokia specific.
The ke ......
[Bug 230608] missing config.h in latest -14
Ralf Corsepius rc040203 at freenet.de
Tue Mar 6 13:31:13 UTC 2007
Previous message: [Bug 230608] missing config.h in latest -14
Next message: [Bug 230608] missing config.h in latest -14
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ......
该实例首先需要创建数据库,数据库Test唯一表test,该表具有三个列分别为c1,c2,c3, int型,请自行建立数据库并插入几行测试数据。
然后我们希望能将数据库中的数据读取出来,我在此处只是将数据库数据以数据集的方式存放在本地中, ......
(一) 先讲一下XML中的物殊字符,手动填写时注意一下。
字符 字符实体
& &n ......
XmlDocument doc = new XmlDocument();
string strtxt = "";
doc.Load(Server.MapPath("XMLFile1.xml"));
&nbs ......