473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

SQLXML classes deserializing.... nothing....

I am using SQLXML to pass data back and forth, well I am trying to. I
try to follow a tutorial but it didn't work completely. Here is my
problem. After everything executes with NO errors, my class has no
data. Here were my steps.

1. In Query Analyzer, I ran my Select statement....
Select * From Notifications Where UserID = '4192' and ParentID IS
NULL for XML AUTO
It returned...
<Notifications ID="1" UserID="4192"
CreatedWhen="2004-08-31T00:00:00" ModifiedWhen="2004-08-31T00:00:00"
ModifiedBy="1" Class="1" Name="CONSILIUMSOFT
" Enabled="1"/>

2. I saved the result in Test.xml.

3. Ran XSD on it. C:\Test>XSD TEST.XML
This MS utility wrote out the schema file, TEST.XSD

4. Ran XSD on it to create the class. C:\Test>XSD TEST.XSD /classes
/language:cs
This MS utility wrote out the CS class file, TEST.cs

5. Added the CS file to my project, create a class around it and the
code is below.

My problem is that when I put a break point where is says BR (in the
code below), pNotifications has no data in it. All the values are
NULL.

ANY ideas? I getting desperate....I should mention that I am doing
this in ASP.NET and SQL 2000 sp3
Ralph Krausse
www.consiliumsoft.com
Use the START button? Then you need CSFastRunII...
A new kind of application launcher integrated in the taskbar!
ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg
************CODE*******************

public class CNotifications
{
SqlXmlCommand objXMLCommand = new
SqlXmlCommand(ConfigurationSettings.AppSettings["XMLConnectionString"]);
Notifications pNotifications = new Notifications();

public CNotifications(int iID)
{
try
{
objXMLCommand.RootTag = "Notifications";
objXMLCommand.CommandText = @"Select * From Notifications Where
UserID = '" + iID + "' and ParentID IS NULL for XML AUTO";
objXMLCommand.CommandType = SqlXmlCommandType.Sql;
objXMLCommand.ClientSideXml = true;

XmlReader pXMLReader = objXMLCommand.ExecuteXmlReader();
XmlSerializer pSerializer = new
XmlSerializer(pNotifications.GetType());
pNotifications = (Notifications)pSerializer.Deserialize(pXMLReader) ;
pXMLReader.Close();

}
catch (SqlXmlException objEx)
{
objEx.ErrorStream.Position = 0;
string strErr = (new StreamReader(objEx.ErrorStream).ReadToEnd());
throw new Exception (strErr);
}

BP}
}
Nov 12 '05 #1
0 906

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ralph Krausse | last post by:
I am using SQLXML to pass data back and forth, well I am trying to. I try to follow a tutorial but it didn't work completely. Here is my problem. After everything executes with NO errors, my class...
1
by: Mark Sisson | last post by:
Ok gurus, what would you do? I'm developing an app in C# and trying to use SqlXml but there seems to be a problem at every turn. I want to create a biz object that represents an order to sell a...
0
by: Ralph Krausse | last post by:
Hello all, Newbie here and have a few questions. I wish to use the classes SqlXmlAdapter,SqlXmlCommand,etc in my ASP.NET project but when I add 'using Microsoft.Data.SqlXml', the IDE doesn't see...
1
by: norm dingle | last post by:
Does anyone know how to get the managed classes for sqlxml loaded? I can not seem to get them to load. Thanks norm
1
by: Hollywood | last post by:
I have the following XSD created in VS.NET 2003: <?xml version="1.0" encoding="utf-8" ?> <xs:schema id="ReferralSchama" targetNamespace="http://test.org/Referral"...
4
by: Don | last post by:
Hi: When I read my sqlxml results into a reader and deserialize it, I only get the first record deserialized into my object. If I have five records, they're all in the reader. But how do I get...
0
by: Keith Chadwick | last post by:
In good old asp I could do the following set objxml=server.CreateObject("MSXML2.DOMDOCUMENT.3.0") set tcmd=server.CreateObject("ADODB.COMMAND")...
1
by: campwes | last post by:
Hey, all! We're having trouble displaying SQL Server data in a web site as XML, using a transform. The query is a simple SELECT statement. When running the query, we get the following error from...
2
by: Phillip Galey | last post by:
I have an object called Place which contains only string properties and has the <Serializable()> flag before the class name declaration. I also have a collection object called Places, which is...
0
by: Jaime Stuardo | last post by:
Hi all... I have read that to retrieve SQLXML data from SQL Server 2000 I need to use SqlXmlCommand and similar classes. I have installed SQLXML 3.0 butg I cannot see those classes. What...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.