XML Problem while using Stored Procedure


Author
Message
Doron Farber
Doron Farber
StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)
Group: Forum Members
Posts: 92, Visits: 612
Hi Trent,

I am actually running an sql statement and getting the XML via the ms sql 2008. Testing the XML within the ms sql 2008, it is just fine. When running the below code the XML string is broken.  I am using the BO which is the parent of all the tables that are included within the sql statement? When I copy this line  Me.ExecuteScalar(cmd) into the Watch window and  look into the XML string I am getting an error. 

How can I resolve this problem?


Public
Function GetXMLMenuOptions() As String
Dim cmd As New SqlCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText =
"XML_MenuOptions"

Return Me.ExecuteScalar(cmd)

End Function

Thanks,

Doron


Replies
Doron Farber
Doron Farber
StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)
Group: Forum Members
Posts: 92, Visits: 612
Hi Trent,

Thanks for your reply.

Trent L. Taylor (06/19/2009)
You would be better served to retrieve all necessary result sets and values in a single query versus calling scalar methods if you are going to have very many queries. But to my knowledge there is no limitation.

You mean instead of using this code: Me.ExecuteScalar(cmd)

I should use the below:
Me.FillDataTable(cmd) 
MyBO.CurrentDataTable.WriteXml("c:\OutFile.XML", XmlWriteMode.WriteSchema)

That means since I have fields from other tables I will need to add those properties in that BO as well
Is that what you meant?

Thanks,

Doron

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Possibly. To be honest, I don't understand why you can't bring back more than one value at a time. Whenever I do something like this I want to take as few trips to the server as possible...this will also make the code less complicated.



So before I ever put ANYTHING into a BO, I make sure that I get my data lined out. This generally means that I will open up SQL Server Management Studio and play with the query which will ultimately become a SPROC to retrieve all data sets as I want them to be exported. Now sometimes this isn't totally possible as some massaging may need to take place once in a BO. However, I will be far closer to my goal than otherwise.



The point I was trying to make is that it seems that you could create all of your result sets and populate all of the BOs in one trip versus getting one piece of data at a time.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Doron Farber - 16 Years Ago
Doron Farber - 16 Years Ago
             Glad you got it going! :)
Trent L. Taylor - 16 Years Ago
Edhy Rijo - 16 Years Ago
Trent L. Taylor - 16 Years Ago
                         Thanks will try it out.
Edhy Rijo - 16 Years Ago
                         Hi Trent, Thanks for your reply, let me explain this better... 1) I...
Doron Farber - 16 Years Ago
                             To my knowledge there is not a character limit on a scalar value. The...
Trent L. Taylor - 16 Years Ago
                                 Hi Trent, Thanks for your reply. [quote][b]Trent L. Taylor...
Doron Farber - 16 Years Ago
                                     Possibly. To be honest, I don't understand why you can't bring back...
Trent L. Taylor - 16 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search