473,748 Members | 4,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help reading XSD as embedded resource with SQLXMLCommand

I'm reading xml from SQL Server 2K with VB.net using an XSD schema file
and SQLXML 3.0. I have the below code working fine, but I'd like to change
the code from reading the schema file from a directory to reading the
schema as an embedded resource. Here's my current code, what would I need
to change??

Dim strm As Stream
Dim strmReader As StreamReader
Dim cmd As New SqlXmlCommand(" MyConnectionStr ing")
Dim xmlDoc As New XmlDocument
Dim strXML As String

With cmd
.CommandText = "MyXPath"
.CommandType = SqlXmlCommandTy pe.XPath
.SchemaPath = "C:\MySchemaFil e.xsd" '**I want this to be embedded,
instead of pulled out of a directory**
strm = .ExecuteStream
End With

strmReader = New StreamReader(st rm)
strXML = strmReader.Read ToEnd
xmlDoc.LoadXml( strXML)

I know how to access embedded resources and fill a stream using reflection
but I can't get SQLXMLCommand to accept the resulting in-memory XSD schema
and produce the same results as the above code produces. It seems the only
way to accomplish this is by using SchemaPath which only accepts a
directory path.

Any ideas?
Nov 12 '05 #1
1 4386
I'm trying to reduce the amount of files to deploy. I'd prefer the schema
files be embedded. This is not for a web app, but rather a client/server
application, so I'd prefer to not have a directory full of 30-40 schema
files available to the user's prying eyes. I'm not dead-set on this method,
so if you have a better idea I'd definitely like to hear it. As far as
adding multiple views/schemas to the same file, if that is what you
proposed, I was not aware this was an option. VS.NET doesn't seem to let me
do it within the IDE. Besides the average schema in this project is 80-100
lines with some extending over 300, so if I combined them all into one file
I'd have one big mess of text, don't you think?

P.S.
Thanks for your inquiry, this question has been haunting me a bit. I'd love
to get a fresh perspective.

-Michael

"Mark W" <an*******@disc ussions.microso ft.com> wrote in message
news:10******** *************** ***********@mic rosoft.com...
I don't have an answer, but I'm curious as to why you want to do it? The file is supposed to represent a static view of the database schema. If you
want another view, you just add it to the file. I believe the file is
cached, so there is no performance advantage.
----- Michael Palmer wrote: -----

I'm reading xml from SQL Server 2K with VB.net using an XSD schema file and SQLXML 3.0. I have the below code working fine, but I'd like to change the code from reading the schema file from a directory to reading the
schema as an embedded resource. Here's my current code, what would I need to change??

Dim strm As Stream
Dim strmReader As StreamReader
Dim cmd As New SqlXmlCommand(" MyConnectionStr ing")
Dim xmlDoc As New XmlDocument
Dim strXML As String

With cmd
.CommandText = "MyXPath"
.CommandType = SqlXmlCommandTy pe.XPath
.SchemaPath = "C:\MySchemaFil e.xsd" '**I want this to be embedded, instead of pulled out of a directory**
strm = .ExecuteStream
End With

strmReader = New StreamReader(st rm)
strXML = strmReader.Read ToEnd
xmlDoc.LoadXml( strXML)

I know how to access embedded resources and fill a stream using reflection but I can't get SQLXMLCommand to accept the resulting in-memory XSD schema and produce the same results as the above code produces. It seems the only way to accomplish this is by using SchemaPath which only accepts a
directory path.

Any ideas?

Nov 12 '05 #2

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

Similar topics

2
398
by: Varun | last post by:
Hello Despite all the advise i have recieved from everyone on this group i still cannot fix this error. I am fast approachin my deadline so i need to fix this asap :o I get the error whenever i try to open the a for My coding falls over on this line.... Me.Button2.Image = CType(resources.GetObject("Button2.Image"), System.Drawing.Bitmap
1
2124
by: Linesh Gajera | last post by:
Hi Guys i having the same problem with Strongly typed dataset, I have created a stronsetly typed dataset by draging table from Server explorer and now i have retreived xml from SQL server 2000 and tried to populate dataset but it populates 0 rows even though ml contains rows. If i use regular Dataset instead of Typed dataset, then everything works just fine..please help me as soon as possible, here is my code snippet. I think you have...
2
5050
by: Keith Chadwick | last post by:
I noticed an earlier post, Multiple External References in Transform - Background to the problem - Long Post, where the poster referenced an object entitled SqlXmlCommand. I am unable to find this object? My requirement is thus. Read several tables from sql server 2000 db with the auto xml feature and read them into a single XPathDocument. Each of the tables need to be read as seperate calls and placed in a single XPathDocument. The db...
2
7563
by: Json | last post by:
Ok, brand new to SQLXML 3.0 and its various issues. Heres what I'm trying to do: 1. I am trying to load xml data into an empty SQL table from my .NET console application. 2. This isn't a huge amount of data so I'm not interested in BulkXMLLoad (or whatever its called). 3. I have the xml and xml schema ready to go, with (I hope) the proper sql annotations.
1
24178
by: james | last post by:
What class / method should I be using to get the full path to an embedded resource ? In my case I have an .xml file that my app uses, it is set as embedded resource, and I have a control that needs to load it, but I do not want to hard code the path since that may change for different installs. i.e. GetPathForResourceOfName ( myResourceFileName ) thanks, JIM
1
1299
by: KMILO | last post by:
Hello, Thanks ins advance for reading my message Im trying to use many .resx files for different webforms when I try to the project the following error appears: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "Site.resources" was correctly embedded or linked into assembly "Site". baseName: Site locationInfo: <null> resource file name: Site.resources assembly:...
0
1325
by: Steve B. | last post by:
Hi all, I'm looking for a pretty way to globalize an ASP.Net application. I base on the Globalization Architecture for ASP.NET article from the MSDN Library. If I have a user control named DesktopBanner.ascx (from Portal Starter Kit), I added two files in the same directory using the "application resource
1
1607
by: thomson | last post by:
Hi all, I have added a new Item in my Solution Test.sql which has got some sql scripts and i have changed the Build Action Property of the file to embedded Resources private string GetSql(string Name) {
1
4228
by: Georg Hickel | last post by:
Hi, in my app i need a script to setup a database. The script file is now read by the app with a streamreader. Now i want to read the script from an resource file which is embedded in my app. I created a resource "installscript.resx" and added the file "script.sql". Now i dont know a way the read the content of the file in the resource. i would like to read from the resource like i did from the original file,
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9544
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.