对数据库进行XML序列化?

对数据库进行XML序列化?
Oralce数据库!
SQL或者是Oracle 都可以的
序列化的意思在于什么?

第1个回答  2008-08-26
你是要对数据库取回的信息进行XML序列化?
如果是这样直接用DataSet就可以了,DataSet本身就是个XML~

序列化的意义在于将引用类型转为值类型,主要作用是传递~
因为我们在给远程计算机传递数据的时候不可能给对方传递一个自己的内存地址~
第2个回答  2008-08-07
// Create the connection.
string constr = "User Id=scott;Password=tiger;Data Source=oracle";
OracleConnection con = new OracleConnection(constr);
con.Open();
// Create the command.
OracleCommand cmd = con.CreateCommand();
// Set the XML command type to query.
cmd.XmlCommandType = OracleXmlCommandType.Query;

// Change the SQL query, and set the maximum number of rows to 2.
cmd.CommandText = "select * from emp e";
// Set the XML query properties.
cmd.XmlQueryProperties.MaxRows = 2;
cmd.XmlQueryProperties.RootTag = "ROWSET";
cmd.XmlQueryProperties.RowTag = "ROW";

Stream stream = cmd.ExecuteStream();

// 将这个Stream写到XML文件里就可以了,这步相信对你来说很容易本回答被网友采纳
第3个回答  2008-08-07
DataSet ds = new DataSet();//只是示例代码,你可以写这里获取dataset对象
ds.WriteXml("文件名")
相似回答