SQLXML Classes Deserializing.... Nothing....
Jul 20, 2005
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
{
SqlXmlCommandobjXMLCommand = new
SqlXmlCommand(ConfigurationSettings.AppSettings["XMLConnectionString"]);
NotificationspNotifications = 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}
}
View 1 Replies
ADVERTISEMENT
May 23, 2007
As you all know, in Framework 2.0 on the desktop platform you have the convenient "abstract" Db* classes that can be used to write more generic code. For instance System.Data.SqlClient.SqlConnection inherits from System.Data.Common.DbConnection, and so forth. Now the docs clearly say that this applies to the corresponding classes in the Compact Framework. And i have seen this implied by other web searchs I've done. However this does not seem to be the case -- or, I'm missing something somewhere.
The following simple code on the desktop platform compiles OK:
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
DbConnection conn = new SqlConnection();
However it doesn't compile in a compact framework project: "Cannot implicitly convert type 'System.Data.SqlClient.SqlConnection' to 'System.Data.Common.DbConnection'".
Reflector also indicates that the Compact Framework class doesn't inherit from DbConnection.
OK, so am I missing something here, or what was the reason that Microsoft did it differently??
View 1 Replies
View Related
Aug 18, 2006
Anyone have a recommendation on SSIS classes (providers and instructors)? It looks like Brian Knight's classes must be at the top of the list. His classes are always full!
View 5 Replies
View Related
Mar 25, 2008
hello all
how to store a page(html) in the database.the product description will be very lengthy(above 10000 characters).if stored how to fetch these data and display it?
regards
Sweety
View 1 Replies
View Related
Sep 24, 2007
Could someone tell where i can readup on xml in laymans turns so i can get the idea of why we need this. I know it has a lot to do with relational data.
Regards
ROB
View 1 Replies
View Related
Jun 8, 2006
Is it possible installation SQLXML 3.0 on Windows 2003 Server???
View 1 Replies
View Related
Nov 1, 2006
Hi,
I'm in the process of updating an HTA hosted application to SQL Server 2005 Express, using javascript with ADO for database access. I have one function to which I pass an SQLXML query template or updategram for all database queries and updates:
function doSql(sXml) {
var cmd = new ActiveXObject('ADODB.Command');
var conn = new ActiveXObject('ADODB.Connection');
var strmIn = new ActiveXObject('ADODB.Stream');
var strmOut = new ActiveXObject('ADODB.Stream');
var xml = new ActiveXObject(sDOM);
xml.async = false;
try {
conn.Provider = "SQLOLEDB";
conn.Open("Provider=SQLOLEDB.1;Persist Security Info=True;"+
"Initial Catalog=CGIS;Server=(local)\ocean;Integrated Security=SSPI;");
conn.Properties("SQLXML Version") = "SQLXML.3.0";
cmd.ActiveConnection = conn;
cmd.Dialect = "{5d531cb2-e6ed-11d2-b252-00c04f681b71}";
strmIn.Open();
strmIn.WriteText(sXml);
strmIn.Position = 0;
cmd.CommandStream = strmIn;
strmOut.Open();
cmd.Properties("Output Stream").Value = strmOut;
cmd.Properties("Output Encoding").Value = "UTF-16";
var iCount;
cmd.Execute(iCount, null, 0x400);
conn.Close();
xml.load(strmOut);
return xml;
} catch(e) { alert('A database error occured: '+e.description+'Query:'+sXml); }
I understand that SQLServer 2005 has SQLXML built in, which can be accessed using ADO.Net. Can it also be accessed using COM ADO? When I changed the connection string to this:
conn.Open("Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=\.pipeSQLLocalSQLEXPRESS");
I get this error:
'A database error occured:
SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].'
Sounds like a connection string error however this was the connection string I pulled out of a .udl file that connected successfully.
Any help/suggestions greatly appreciated!
Andrew
View 1 Replies
View Related
Jun 4, 2007
Hi Group !!
I`m developing a web site with many grids, these grids obtains the data from a SQL Server 2005 DB which data is stored in XML Format... many times when the page load is done, this message appears :
File or assembly name Microsoft.Data.SqlXml, or one of its dependencies, was not found.
But when I access a second time to the same page, the data is displayed normally..Why this could be happening???
Thanks
Diego G.
View 2 Replies
View Related
Sep 14, 2006
Who use sqlxml .net?
How can I write code like this:
select count(1) as count from Orders for xml auto
That's error.
And what is the correct sqlxml code?
Tks.
View 3 Replies
View Related
Dec 9, 2005
I'm still trying to transition from a DB-centric view to an OO view,
and I could use some help from any of you OO-design wizards out there. A very common db representation is Table A, Table B, and Table A_B, which maps the two in a one-to-many relation. E.g., create table Companies ( companyId int, name varchar ); create table Products ( productId int, name varchar ); create table Companies_Products ( companyId int, productId int ); So how does this translate into object-land? I started with: public class Product public id as integer public name as string end class public clas Company public id as integer public name as string public products as generic.list(of Product) end class OK,
so far, so good -- I've represented most of my data. But I've lost some
important information: given a Product object, I have no easy way to
find out which company sells it. SQL: scan the Companies_Products table OO: iterate through companies, nested iteration through company.products. Do I just add a function to my data access layer that does the lookup? Is that allowed? On
a side note: can anyone recommend a good intro to OO design
specifically for database programmers? It seems like most of my
confusion comes from issues of translating tables into classes. Thanks!
View 3 Replies
View Related
Jul 27, 2006
ahi all
iam new to VS.net 2005 and iam trying to convert ready made application from vb.net 2003 to vb.net 2005
and i cant find the sqlcedataadapter
its a windows CE application uses SQL Server CE
and i imported the system.data.sqlsrverce
and i added the sqlserverce refrence
may be its a new classes?
View 1 Replies
View Related
Jun 4, 2007
Hi Group !!
I`m developing a web site with many grids, these grids obtains the data from a SQL Server 2005 DB which data is stored in XML Format... many times when the page load is done, this message appears :
File or assembly name Microsoft.Data.SqlXml, or one of its dependencies, was not found.
But when I access a second time to the same page, the data is displayed normally..
Why this could be happening???
Thanks
DiegoG
View 2 Replies
View Related
Feb 27, 2007
I am trying to use VB.NET to run SSIS packages. However I don't have the various dts namespaces available. When I attempt to import them I only have Microsoft.SqlServer.Server in intellisense.
I am running on XP sp2, VS 2005 (full install) and even went so far as to install sql 2005 sp1 full install on my local machine.
What gives with only having Microsoft.SqlServer.Server available?
thanks,
Scott
View 10 Replies
View Related
Oct 9, 2007
Hi all,
Do I still need to write the .sql query statements (in SSMS) if I use the ADO.NET connected classes like GetSchema method or the DbDataAdaptor Object?
I'm very new to Visual Studio 2005 & SQL Server 2005..
Thanks!
View 3 Replies
View Related
Nov 22, 2006
I show business objects in the ReportViewer as it is described in the MSDN article [1]. In the article they only use intrinsic types like int and string as properties of the business object.
My business objects contains also structs and classes (e.g. Point) as Properties. I expected the Reporting Services to call the ToString() method if it is not an intrinsic type. But it only shows the error string "#Error" in the TextBox.
How can I show a Struct property of my business object as a report value?
[1] MSDN article: "Walkthrough: Using a Business Object Data Source with the ReportViewer Windows Forms Control in Local Processing Mode"
View 1 Replies
View Related
Apr 19, 2004
Hello -
I've used SQLXML to generate WSDL from a sample stored procedure that returns customerID and contactName from the 'northwind' database based on a runtime-supplied parameter.
However, the generated WSDL doesn't explicitly name the two columns (customerID and contactName) that the procedure returns. I've tried all of the possible combinations of 'row formatting; and 'output as' when configuring the virtual name. Instead, I get the following:
- <xsd:element name="TestResponse">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RobTestResult" type="sqlresultstream:SqlResultStream" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
To parse the results, I would have to cast the information correctly, which requires some hard-coding. Does anyone have any suggestions on how to force the WSDL file to correctly list out the individual elements in the result set?
Many thanks!
Robert
View 1 Replies
View Related
Sep 5, 2004
I work on the Clinical Surgery Department Data Application.
The patient gets through the Admission, Surgery, PostSurgery and Discharge stages during his staying in the department. The Doctors just insert their medical data in to the different tables. I have three main classes: User, Patient and Portfolio ( patients portfolio ) and all the business bases on these classes.
The problem is with the Classes per Medical Data Tables. The Medical tables should exist cause it includes the medical data about the patient however what is not clear: Whether I should create Business and Entity classes per each medical data table ( and this is something like 50 tables ) or I should insert all the functions in the Portfolio class and then there will be a mess of functions in one class? What is the accepted way to perform it ?
View 1 Replies
View Related
Jan 6, 2007
Hi,
I'm using WinXP SP 2, IIS 5.1, SQL Server 2005 Standard, and Visual Studio 2005 Professional.
When I create a virtual directory with IIS Virtual Directory Management for SQLXML 3.0, I get a Microsoft SQL isapi extension error when going to the default page.
If I delete the virtual directory, and then add it directly in the IIS snap-in, with executable permissions, all goes well.
My website is from the Wrox book, Beginning ASP.NET 2.0. An appendix in the book says to add the virtual directory with the SQLXML 3.0 tool, and not to use IIS. I'm very new to this, so I'm not sure if I'll lose functionality down the road or not, by using IIS.
Has anyone run into this before or have any ideas how to get sqlxml 3.0 virt. dir's to work?
View 1 Replies
View Related
May 2, 2007
I need to update a number of sql server tables, the data sources for these coming from a number of stored procedures. I want a generic way of getting the data and then passing this data to the tables.I am thinking of doing this for each table:Populating a datasetWriting this dataset to XMLUsing SQLXML Bulk Load to pass this XML to the database to updateI can create the xml data file by:
dataset.WriteXml("C:data.xml")The problem I have is that the example (http://support.microsoft.com/default.aspx/kb/316005/en-us) I looked at relies on the schema being defined:<?xml version="1.0" ?><Schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:xml:datatypes" xmlns:sql="urn:schemas-microsoft-com:xml-sql" > <ElementType name="CustomerId" dt:type="int" /> <ElementType name="CompanyName" dt:type="string" /> <ElementType name="City" dt:type="string" /> <ElementType name="ROOT" sql:is-constant="1"> <element type="Customers" /> </ElementType> <ElementType name="Customers" sql:relation="Customer"> <element type="CustomerId" sql:field="CustomerId" /> <element type="CompanyName" sql:field="CompanyName" /> <element type="City" sql:field="City" /> </ElementType></Schema>Is there any way I can create the schema 'on the fly' similar to how I did for the data source file.As I could then pass these files to the database:objBL.Execute ("schema.xml","data.xml");
View 1 Replies
View Related
May 28, 2008
All --
Please help.
I need to know how to refresh Linq-To-SQL classes after schema changes without dropping and adding them.
Now, when I make a schema change (such as add or delete a column to a table), I want to "refresh" the Context.dbml file.
The only way that seems to work is to drop the table from the Context.dbml designer and then add it back in.
Is there a better way to do this?
How are others doing this?
Please advise.
Thank you.
-- Mark Kamoski
View 5 Replies
View Related
Jan 10, 2006
Hi,
Hopefully someone out there will be able to help me with this question. I'm trying to setup my C# program to use the Backup and Restore classes to perform backups and restores on an SQL Express 2005 database.
From the documentation I've read... it seems that when you go to restore the database, it's a good idea to backup the current transaction log. But when I do this using the Backup.SqlBackup method I get an error saying that no database backup is detected so a log backup can't occur. I'm not sure if this has something to do with the fact that I moved my backup files from the default SQL Express/Server Backup folder to a different location. Shouldn't it know I've already performed a backup though?
And does anyone know how to set a parameter to backup to a different file location than the default? I've been doing a backup then a file move. Works the same, but it would be nice to have everything together in the Backup object.
Thanks!
View 4 Replies
View Related
Nov 3, 2007
Hello,
I'm trying to follow a sample from microsoft for Using SQLXML Bulk Load in the .NET Environment
In the sample c# console app. it says to select add reference then In the COM tab, select Microsoft SQLXML Bulkload 4.0 Type Library (xblkld4.dll) and click OK.
The problem I have is I cannot find the library or the xblkd4.dll file on my pc.
Does anyone have any suggestions? Any help would be much appreicated.
Thanks
Karl
View 5 Replies
View Related