.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Reading XML from a text field

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :Sql Server



I have a db text field that contains XML.


ike for example:

field name: content

<root><Default><ClassTitle>test class</ClassTitle> <ClassDescription>description</ClassDescription> <Location>Bethesda</Location> </Default> </root>

i need to only find records that have Location node = Bethesda....

right now this is what i have...


SET     @xVar = (SELECT content_html FROM content FOR XML AUTO,TYPE)

select top 5  * 
from content
where content_status = 'A' and content_type=3333
and end_date >= getdate()
Location [1]' , 'nvarchar(500)') = 'Bethesda'


View Complete Post

More Related Resource Links

FormView Text Field Being Set by A Drop Down List


Hello, I have a FormView which is used to insert a record into a database.  Outside of this formview i have a drop down list, I want to grab the value from that drop down list and set one of the text fields within the formview to it's currently selected value.  I've tried the following code, but the dynamic categorytextbox line is what seems to not be working.

                    <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True" 
DataSourceID="SqlDataSourceCategory" DataTextField="CategoryName"
DataValueField="CategoryID" Width="200px">

                            <asp:TextBox ID="CategoryIDTextBox" runat="server" 
Text='<%# Bind("CategoryID") %>' Visible="False" />

        protected void FormView1_DataBound(object sender, EventArgs e)
dynamic varCategory = ddlCategory.SelectedValue;
dynamic categoryTextBox = FormView1.FindControl("CategoryIDText

Mission Impossible? Use Javascript to Disable a Multi-Line Rich Text Field


Hey Community,

Here's a tough one that I have struggled with and so far have not been able to find an answer for - how do you use Javascript to disable a multi-line rich text field.  I have customized a SP Edit form by adding a CEWP.  In the CEWP I have added the Javascript below (only a partial code sample provided) to disable several fields in the form.  The code works fine for single line text fields but it does not work for multi-line rich text fields.  Any suggestions?

<script language="javascript">
//This runs the function when the form first loads

//This locks the fields the users should not modify
function lockFields()
  var theInputTFTitle = getTagFromIdentifierAndTitle("Input","TextField","Title");
  theInputTFTitle.readOnly = true;
  theInputTFTitle.style.color = 'gray';
  //alert(" Value: " + theInputTFTitle.value);//for testing

   var theInputDDLReplyStatus = getTagFromIdentifierAndTitle("select","DropDownChoice","Reply Status");
  theInputDDLReplyStatus.disabled = true;
  //alert(" Value: " + theInputDDLReplyStatus.value);//for testing

  var theInpu

How to read a column of a sharepoint list to a text string field of infopath form?

My infopath form used to read these email addresses from a web service and web.config file. Now i would like to get these user email addresses from a contact list in a sharepoint server. I am trying to do this without writing any codes. Here is what i have done so far: 1. Adding a new "data connection to receive data from SharePoint library or List" where i selected Email Address column of the contact list. 2. I added a new Text Field and define a new rule with "Query using a data connection" defined above. When i try to access the newly created Text field above it always return empty as if the Query attached to it did not executed at all. What did i do wrong? Is there a better way? Thank you in advance for your help.

Adding starting text to a column field

I am wanting to know if there is a way you can add starting text within a field that displays within a page layout?  I have a page layout that has a field (column) called 'page summary'. What I want to do is when a content managers creates a new page based on that page layout, the text "This page contains a public notice" is automatically inserted in the page summary field and the content manager can continue typing or highlight the text and remove it. Kind of like adding a base 'Text Value' to the field (column).  I want to be able to do it without having to do custom code though.

Get Text Value in Gridview from Invisible Field

Hello,  I've run into this before, but I was using a formsview and just changed the field to hidden.  If you've seen my previous post I am trying to get the value of a cell out of a gridview to a variable and here is the code: Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged Dim varClientID As String = GridView1.Rows(GridView1.SelectedIndex).Cells(6).Text.ToString() End Sub This works perfectly if column 6 is visible, but because it's an id number (which is not the primary key) I do not want it visible, but changing it to visible="false" causes this code to return null.  Changing it back to visible and it works.I'm not sure why the visiblity of a control changes the functionality of it.Are there any other ways to get this data out?

Showing highlighted text (HTML) in calculated field?

Greetings all,   We're porting our 2007 list to 2010. In Sharepoint 2007, we used the following Calculated Column code to display a highlight over items that had different statuses:   =IF(Date="","<DIV style='background-color:#ff6666'>Not <b>Yet</b> Set</DIV>", IF(Finalized=TRUE,"<DIV style='background-color:#66ff66'>Finalized</DIV>", "<DIV style='background-color:#fffa91'>Tentative</DIV>"))   When we use this in Sharepoint 2010, it doesn't seem to apply the DIV structure. Any ideas of how we can change our code to make this work? Thanks! --Dave   No matter -- I need to add a code snipped ( http://marijnsomers.blogspot.com/2010/01/write-html-code-in-sharepoint-via.html ) to the page... thanks!

Rich text field showing html code

I am an end user of Sharepoint. This issue only happens from my computer, not from any other within our organization. What happens is that when I edit an item in Sharepoint that contains a rich text field, HTML code is showing. Like so: <div class=ExternalClassC900CFF4F2BF4312A89133C01A6E3C96> Some text</div> This happens from any web browser. Sharepoint 2007 is used. I have Windows 7 x64. Any idea what is causing this?

Text field in survey

Hello Everybody. I'm trying to do a survey, but have some doubt about it. I'd like do insert some text field in Sharepoint Services 3.0 Survey. Example: TextField: Fill in Server Informations Survey Question: Numbers of servers: XXXX Survey Question: Numbers of HP Servers: XXXX   I haven't problem to use the survey question, but I don't know how do I to insert the text field.   Someone knows?  

Overlay Image in InfoPath with text field

Hi, We are currently designing a simple test for some employees to take and it will be delivered via InfoPath forms services. Upon successful completion of the test the userr will be invited to click a button to view (then print) their certificate. The certificate has been received as a .jpg. Is there any way to overlay the image with a text box, as this would enble the user to print a certificate where their name appears on it.

SharePoint 2010 Rich Text Editor field

I want to embed iframe tag in Sharepoint 2010 rich html text editor control, but it is simply remove the tags when i save the content. Please let me know how can i do this?

Display each new line of a sharepoint mutliline text field as choice in drop down box.

The question pretty much says it all. I have a lot of data I need to represent, and this would be the best way to do it. I have a multiline text field in sharepoint, where each line has a choice that should be a seperate choice in a text box. How do I do this? I have the data connection set up, and I would be fine with adding some sort of tag after each line, if that would make it so infopath can somehow parse out those tags, and interpret each "chunk" as a choice. Thanks in advance for your help.

xml as text will not save in table field in some cases

I have a stored procedure that saves 4 fields into a data table named xml.  One of the fields is called xml, and is just a text field.  Usually, my sp properly stores the data, but occassionally the xml portion of my record is not stored.  It's on a remote server, so I'm having trouble hooking up a debugger to it, but I may have identified some charactoristics of the data in the cases where the data is not saving into the field.  I think it has a lot of "......."s mixed in with the xml.  I'm wondering if SQL could be identifying this as some kind of security threat.  Any thoughts would be super appreciated. 

Multiline text field in document library and item update from Word trouble

Hi I have faced a bit of odd problem. Here is the scenario: I have document library with text columns (multiple lines of text) that are set to unlimited length. I have a workflow that runs with Word documents (.docx) that stores information in XML to this field. Everything works perfectly until document is edited in Word and saved back to document library. After Word saves my document in document library, the multiline text field is "cutted", only 7 rows of text is saved to my field. I have tried hiding my text field, making it sealed or readonly, but still Word breaks my field. Funniest thing is that when editing document in Word, this field should not have any changes (meaning that I dont show my "long text field" in document information panel back in Word). I have tried also creating event handler to handle itemupdating event in document library where I switch spweb.parserenabled property to false and in itemupdated event I switch it back on. Also I have tried to remove all line changes from XML with no luck. This XML saving to long text field works perfectly with many other places but in this one environment this does not seem to work :( I am looking forward to any suggestions what to try next. I have been wondering about using the eventhandlers and trying to "protect" my text field with some logic but that is still just a thought.   T

Reading each record from a text file and sending email

Hi All, I have a text file (CSV) which has only three fields (Name, Email, SendYN). I want to read each record from this text file and send email to those records where SendYN field has Y. I had created Flat File connection and a Flat File source in a data flow which uses Flat file connection. Now I stuck how to move further. Which control I need to add and where to identify whether SenderYN = Y and how to send email? I am new to SSIS. Thanks.

Reading WPF rich text box content in HTML format

Hi, I am using WPF RichTextBox. From that, I am reading the content in RTF format using the following code. TextRange textRange = new TextRange(paramRichTextBox.Document.ContentStart, paramRichTextBox.Document.ContentEnd); MemoryStream msData = new MemoryStream(); textRange.Save(msData, DataFormats.Rtf); //get the data from the selected range //strData = textRange.Text; strData = ASCIIEncoding.Default.GetString(msData.ToArray()); I also found that there is an option called DataFormats.HTML. Hence, I tried using this but ended up with error. Is there any other way to read the content of RichTextBox in HTML format? Thanks in Advance!!! Best Regards, Subalakshmi Vijayarajan.

XML data stored in text field

Hi there, I need to extract XML data stored as text from any number of given rows of a table. The stored XML data typically looks like this: In the ATTRIBUTES field from NODEMEATADATA table <T41><A93>S46 SE Trade &amp; Investment</A93><A35>3284</A35><A84>28 November 2008</A84><A33>S Polkinghorn Bband</A33><A46>S46 0501-KEYF Keyfort Limited</A46><A89>400.68</A89><A90>0</A90><A88>400.68</A88><A66>560200 Broadband</A66><A70>ITAC</A70><A54>N/A</A54><A86 /><A87>Awaiting Posting</A87><A91>Mashudul Karim</A91><A94>Chris Burchell</A94><A92 /></T41> I need to be able to extract the invoice numbers from any number of rows based on a WHERE clause that referes to another column of a date/time format. The invoice numbers are with the <A35>****</A35> tags What I have noticed in the table is that element is not always the same. SOme are <T41> some <T6> or <T7> which I think might have something to do with the document status within the <A87> tags. If possible I need to pick up within multiple elements. I then need to add this to my current simple query: SELECT METAID, CONVERT(VARCHAR(10), CAST(CAST(CREATEDON AS VARCHAR) AS DATETIME), 103) AS 'CREATED', FROM N

Only show text from database if field is not empty

 Hoping someone can help. I am using ASP.NET VB and i am wondering how to only show text from database if data exists. I tried this but it does not work.Any help would be greatly appreciated.I am new to .NET, in the past i have always used classic asp. 1 <td valign="top" style="border-right: 2px solid #031992"> 2 (<%# Eval("VenderPhone1") %>) <%# Eval("VenderPhone2") %>- <%#Eval("VenderPhone3")%> 3 4 <% If String.IsNullOrEmpty(Trim("VenderAlt1").ToString) Then%> 5 <br />(<%#Eval("VenderAlt1")%>) <%# Eval("VenderAlt2") %>- <%#Eval("VenderAlt3")%> 6 <% End If%> 7 <% If String.IsNullOrEmpty(Trim("VenderFax1").ToString) Then%> 8 <br />(<%# Eval("VenderFax1") %>) <%# Eval("VenderFax2") %>- <%#Eval("VenderFax3")%> 9 <% End If%> 10 11 </td> 12   
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend