|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can't read records with '' in varchar from SQL server into xmlnot are allowed to be null. Some of the records are '' because they not have any data at the moment. I try to read all records from that table into a dataset using a stored procedure. The code below is a part of that. The procedure contains a "select * from" statement. The problem is that the xml file contains the following row for the machinedata column with ''. <Table> ........ <machinedata /> ........ </Table> This row will be ignored when i trying to read i with the DataSet.ReadXml method. Is there any way around this. /Thanks Here is a fragment of the code: SqlCommand oExCmd; DataSet oDataSet; SqlDataAdapter oDa = new SqlDataAdapter(); oExCmd = new SqlCommand( "sp_" + sTableName + "_read", oConn); oExCmd.CommandType = CommandType.StoredProcedure; oDa.SelectCommand = oExCmd; oDataSet = new DataSet(); try { oDa.Fill( oDataSet); } ..... oDataSet.WriteXml( "..\\Db\\" + sTableName + ".XML", XmlWriteMode.WriteSchema); |
|||||||||||||||||||||||