.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

Add line to existing xml file

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :ASP.Net

Hello every one I have tried to add some line to existing xml file but every time that i did it previous lines was replaced by new one

i tried to use dataset,streamreader and ... but i couldnt,


please help me  

View Complete Post

More Related Resource Links

New off line application working with sdf file. Need advice


Hey Folks

I am working on a project currently where I need to get data out of a 3rd party vendor's software that uses a .sdf file I looked this up and its a SQL CE file. I was hoping to just link to with with access but thats apparently not going to happen. I need to link to the database extract data from it to a csv file for later use. I also and most important I need to get the data from it and create a report that can be printed while on a customers site that my or may not have web access so I need for this program to be on and off line. I had my webapplication that I have been working on open and was able to bring up the sdf file under the server exploere however I can't seem to get anything out of it when I try to do grid views or detail views errors out.

Can I use one of Visual Studio projects to create this sort of applicaiton if so what would be the best approach. I would love to get an access odbc driver since office is allready installed on the employee's laptop's



Deleting Last Line of Text in a text file

Hi, I needed some help on the best way to delete the last line of  text in a text file. I have a subroutine that looks like this, but it is missing some code. Could anyone advise me on this? Dim strLogFile As String = System.Web.HttpContext.Current.Server.MapPath("~/Log.txt")         Dim fs As New FileStream(strLogFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None)         Dim swLog As New StreamReader(fs)         Dim array As String()         Dim value As String = swLog.ReadToEnd ''Array that holds the lines of the text file.         array = value.Split(vbCrLf)        ''code for deleting last line: . . .  fs.Close()

How to replace a file with existing file in SPDocument libray for an SPItem through Object model...

Hello All, Step1: I have created an SPItem in document libray by choosing a file through object model. Step2: Now i want to replace the existing file of the same SPItem with new file. How can i achieve this using SP Object model. Thanks in advance...

Adding New Column to XSD File Without Remapping existing Transformations

Hello, I am loading XML file using SQL 2005 SSIS and using XSD file for XML Schema defination. Now I have a requirement where I should add couple of new columns in XSD as the XML (MAY) have extra columns for few of its tables. Is it safe to add new columns to XSD and the Map only new columns in Data Flow and all will work? or after I add new columns I need to redesign all mappings as Column order will change. (I think SSIS refere a numeric value for each column, if Yes how can I add new column with less impact)? Thanks, Prabhat Nath

i require go which file which line no error and how ro remove thsi

i require go which file which line no error and how ro remove thsiSystem.NullReferenceException: Object reference not set to an instance of an object at System.Web.UI.WebControls.ListBox.SelectMultiple (System.String[] values) [0x00000] in <filename unknown>:0 at System.Web.UI.WebControls.ListBox.LoadPostData (System.String postDataKey, System.Collections.Specialized.NameValueCollection postCollection) [0x00000] in <filename unknown>:0 at System.Web.UI.WebControls.ListBox.System.Web.UI.IPostBackDataHandler.LoadPostData (System.String postDataKey, System.Collections.Specialized.NameValueCollection postCollection) [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessPostData (System.Collections.Specialized.NameValueCollection data, Boolean second) [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessPostData () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.InternalProcessRequest () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0

How to read/write GIANT text file with no line breaks


I have to process giant XML files that are 6GB+ in size.  The problem is that there are no line breaks in the file, and the XML is improperly formatted (no root element).  Therefore I can't use the XML class to read the file, and I can't open the file in any text editor or even "Type" it in a command window because the 1 line in the file is over 6GB.

The file contains UTF8 characters.  What I want to do is first write a program just to read and display 100 characters at a time so I can look at the contents.  Next I want to be able to create a new file, write a root element, read/write the contents of the file and then write the closing root element.

Can anyone provide a code snippet of how to read and display the file contents 100 characters at a time.  I can then figure out the rest.


Random line from a text file



Im trying to pull a random line from a text file and store it into a variable.

I found this piece of code on the web which looks good but I cant seem to get it working in vs 2010, any ideas ?

Dim MyString As String
Dim MyBuffer() As Byte
Open "C:\AFile.txt" For Binary Access Read As #1
  ReDim MyBuffer(LOF(1) - 1)
  Get 1, , MyBuffer
  MyString = StrConv(MyBuffer, vbUnicode)
  ReDim MyBuffer(0) 'Free up memory
Close #1

Many thanks in advance.


SQL Server Assertion: File: , line=913


I've found an article stating that this can occur when the table has no clustered key and you attempt to reindex. That is not my problem.

I am attempting to do a bulk-load into a table using SSIS. I have seen other people having this issue, unfortunately their issue always goes away on its own. I have restarted the service, and the machine as well as installing sp1 and the problem persists.

Here is the error, any help troubleshooting this issue is appreciated

Log Name:      Application
Source:        MSSQLSERVER
Date:          9/21/2010 1:32:07 PM
Event ID:      17066
Task Category: Server
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      TESTSSADB
SQL Server Assertion: File: <pageref.cpp>, line=913 Failed Assertion = 'IS_OFF (BUF_MINLOGGED, m_buf->bstat) || pageModifyType != PageModifyType_Contents || GetPagePtr ()->IsTextPage ()'. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check the database for structural integrity, or rest

How to associate STP file to an existing site in same farm.




single farm


there are 2 web-applications: web-app1, web-app2.


Each webapp has one site collection. that is 


webapp1 has site-collect1


webapp2 has site-collect2


Now for some reason I want to copy site-collect2 to webapp1 as site-collect1.


content-db doesn't work because of database ID issue.


I am trying to use 'save as template' from site-collect2 and can get STP file but how do I assocaite this STP file to site-collect1. I am looking for any STSADM commands or source code that does this. Here also I wanted to create site-template with 'data' but it is giving me error. I will check this later. 

thanks for reading.please suggest.

replacing or removing an existing file in asp.net


i wanna make a system through which a file uploaded replaces a file on the same location and with the same name. how can i do it. please help

add string in existing resource file


hi there
i need to add a string in a existing resource file
i am trying this but does not work
do you know the problem?

Private Function AddString(ByVal file As String, ByVal result As String)
        Dim language As Google.API.Language = Google.API.Language.English

        Dim resxFilePath As String = file '"c:\files"  

        Using rr As New ResXResourceReader(resxFilePath)
            Dim outputFilePath As String = resxFilePath.Replace(".vb", "") & ".resx"

            Using rw As New ResXResourceWriter(outputFilePath)

                rw.AddResource(result, Replace(result, Chr(34), ""))


            End Using
        End Using

    End Function

new line to field name in rdl file to generate a report


Hey i want to generate a report and so while designing the rdl file i want to place some label in the same column name to display ex:

employee details - COLUMN NAME


full name

address etc

all these 3 fields should come under the column name "employees".

my question is - i need the code to place these sub labels in new lin

savefiledialog and openfiledialog: Selecting existing file or creating a new one


In my application (C#) users need to select existing file or create new file where they want to save some data. Existing files are in read-only mode because they are under Perforce subversion source control. I'm going to handle file checkout in my application automatically after user has selected the file where he wants to save data (or if file is new file, application adds it to source control).

The problem is that I can't use savefiledialog, because it complains about selected file being read-only. I could use openfiledialog, but it has couple problems. First problem is that openfiledialog confirm button has text "Open", which is something i could live with even though it would be better if it read "Save" :)

Second and bigger problem is when you want to create new file in openfiledialog. I set CheckFileExists to false so when user writes file name and presses "Open"-button, openfiledialog doesn't complain about file because it doesn't exist and it returns path to "new" file just fine. But problem is that if user has clicked or selected to some folder in openfiledialog and then writes file name and presses "Open"-button, openfiledialog just opens selected folder.

So basically I just need some file browsing dialog which works like savefiledialog but doesn't complain about read-only, i just need to

How to include page.xaml file in existing .net 2.0 project


We have a existing web based project in Asp.net and would like to use third party silver light control in the same application.

We need a help how to include silverlight control and use .xaml to access.

Please help




How to delete a line from a text file using C#

Hello all

I am developing a little app where I need to monitor a file that is update by several machines.

I need to gather each line wrote by each machine so I need access to a specific line number and take that line, store it into a DB table and delete that line.

I really don't know how to delete the line without parse the information into a string variable and rewrite the file. This can lake the app because the file can contain up to 1000K lines... :-O...

Any suggestion will be appreciated.

I think I deleted the Internet...

Removing blank line from a text file


Hi i have a comma deliminated text file which i am using to generate a multidimensional array using the following code:

Dim DefinitiveDatabase As String(,)
    Dim strfilename As String = (Server.MapPath("~\Definitive database.txt"))
    Dim num_rows As Long
    Dim num_cols As Long
    Dim x As Integer
    Dim y As Integer
    Dim value As Integer
    Dim ConditionName As String
    Dim strlines() As String
    Dim strline() As String
    Dim tmpstream As StreamReader = File.OpenText(strfilename)

strlines = tmpstream.ReadToEnd().Split(Environment.NewLine)
        num_rows = UBound(strlines)
        strline = strlines(0).Split(",")
        num_cols = UBound(strline)
        ReDim DefinitiveDatabase(num_rows, num_cols)
        For x = 0 To num_rows
            strline = strlines(x).Split(",")
            For y = 0 To num_col

How to write data into an existing PDF file


HI All,

I Have an existing pdf file with some editable fields like text boxes and text boxes, where i can enter data manually and save the file,

but i want to fill/paint data to these fields programmatically in vb.net, kindly share your thoughts..

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