.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

Concatenate and Overwrite

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :C#
I have a InfoPath 2010 form. I create a Data Connection so I can submit the form and it be saved on a SharePoint 2007 site.  Here is the issue I am running in to.  I can concatenate 2 of my fields together, but ony one of the field will remain constant and the other field will change.  I would like to be able to overwrite the original file everytime I make a change to it.  Right now it will create a new file name and will allow me to update the old one.  Anyone know how to code a formula within the Data Connection or Rule to get the results I want?

View Complete Post

More Related Resource Links

Image file does not want to overwrite.


 I am having an issue with saving an image file to a temp file on the server after it is cropped.  I upload the image on one page and then modify it on another with the option to rotate or crop.  I have the crop feature set as a fixed size and am using JavaScript to accomplish this.  I am getting an error when I try to save the file as the original file name to overwrite it with the modified image file.  I know this has got to be something simple that I am overlooking, but I have been looking at it for a while and can't seem to spot the problem.  I currently have the image saved as "studentid_temp.jpg" in the temp folder.  I want to overwrite this file with the new cropped version of the photo.  Below is the code that i'm using, which gives me the error: A generic error occurred in GDI+.

When I change the file ending to something different (like studentid_temp1.jpg) the new cropped image saves without a problem because it does not have to overwrite the original. 

I have set the permissions on the folder to allow read/write functionality.

Any ideas to easily accomplish this overwrite?  I thought overwrite was kind of the default when a file came across with the same name, or is it because I still have the image open from the display (how would I fix that, if that's

Need help concatenate varible to a SQL WHERE clause


Hey guys,

I looked over the web and couldn't find much help. Can someone help me with my SELECT statement? What I want to do is concatenate a varible to my WHERE clause. This is what I have:


myDataAdapter = new SqlDataAdapter("SELECT * FROM details WHERE DetailsID = " + lstBoxCategory.SelectedValue.ToString(), connection);


I tried this also but it didn't work:

myDataAdapter = new SqlDataAdapter("SELECT * FROM details WHERE DetailsID = '" + lstBoxCategory.SelectedValue.ToString() + "' ", connection);



FileUpload Class SaveAs, how can you overwrite?

Hello all,

I'm trying to use 2.0 class, FileUpload. 
Namespace: System.Web.UI.WebControls
Class FileUpload

Anyway, in my code can save the file to the server

FileUpload1.SaveAs(SavePath + FileName)

Problem is I can't find a way to overwrite the file.  When I try and run the program again is says the file is already in use that a process has access to it.

Is thre a proper way to release control of whatever it grabbing hold of it?  In .Net I don't have to destroy my objects right?
Or is there a way to specificly overwrite the file? It seems that SaveAs does that.  Just trying to figure out why I can upload this text file, but sometimes only once and then I have to code in to check to see if it exists then rename it.

overwrite the files in document library from Explorer View ?

Hi Everyone, Suppose I have a document library which can be opened using the explorer view, what happened if someone uploads to this library by drag n drop into the library with same filename? What would be the final story of the file which is overwritten through drag n drop from Explorer view ? Thanks./* Infrastructure Support Engineer */

how to concatenate special characters in TSQL ?

hi how can i insert special characters like ' to my select output ?? for example, i tried to get the following output but it just doesnt work.. i am using SQLS2K btw, SELECT ' Hi. this is called the 'modern age' ' note that i need those to ' s with the words modern age :)   thanks in advance :)

How do I keep the previous GridView field value and then concatenate new ones?

Hello all, I have a Timer and a GridView who pulls info from the database every X seconds.Every time I query the database the field 'Comments' is replaced with whatever is on the database  (since it's bound to it).I'd like to keep my previous value and keep adding into my Label the subsequent values queried from the database. For instance, first time I query I get a value of "1" in the Gridview. Now someone changes the database row and next time I queryit I have a value of "2". Well, I would like to concatenate the last value queried with the previous one and so on. So at this point the GridView should show "1" and "2". Here is the piece of code I am talking about: <asp:TemplateField HeaderText="Comments" SortExpression="Comments"> <ItemTemplate>  <asp:Label ID="lblComments" runat="server" Text='<%# Bind("Comments") %>' /> </ItemTemplate></asp:TemplateField> How do I achieve this goal? Thank you!

How do I upload and overwrite document while keeping the same document properties?


I need to upload a new version of an existing Word document (same file name) while keeping the properties that have already been set in Sharepoint for the document. I can only find that the properties are either deleted or reset to default values. How do I avoid this?

I have tried both with and without versioning activated. In either case the properties are reset.

I have also tried to overwrite the document throught the web interface and through Office/Explorer. Same apply here.


Query returns correct rows but I am not able to concatenate the rows into a variable :(


Hi all,

Why in the code below I am able to list all rows and display the field 'stepID' but I am not able to concatenate them all in the variable @stepIds?

declare @date as datetime
set @date = '2010-09-20 23:01:20:000'
declare @instance as uniqueidentifier
set @instance = '04658F34-CBF1-4CCD-A683-F23BDB669D35'

  Declare @CrLf char(2)
  Set @CrLf = Char(13) + Char(10)
	Declare @stepIds varchar(8000)
	Set @stepIds = ''
		--@stepIds = @stepIds + ' - Step: ' + CONVERT(varchar(4), stepID)

Find duplicates, concatenate cells


 Hello all,

I have a database where I need to find duplicate rows based on one cell and concatenate the two cells from both into one record. For example i'll have:


ID             NameOne               IDNumber

1              John                        2983

2              Jones                      2983

3              James                     2984


I'm wondering if there is a SQL statement where I can search for the duplicates of "2983" and come out with a record of:

ID             NameOne              

How to concatenate N Prefix to a parameter in sqlserver

How we can concatenate N-Prefix to sqlparameter,i am trying to insert japanese characters into the DB.if i tried like below it's working.

1.  insert into japanese (a,b) values (1,N'C?????');

above is working fine.
if i tried to execute the same by appending to the parameter,it's not working

How to concatenate measures over time period?



For an external tool I have to prepare Sales ([Measures].[Sales]) figures for the last 5 months like this: 12345|12343|21423|12344|12343. So basically, I need one measure that displays these values concatenated. How can I create this? (In my MDX query I would have this measure on columns and i.e. another dimension like country on rows).



Restore using TSQL, how to determine the files to move/overwrite


There might be an easier way to perform it, if so, please advise.  I am looking for a scriptable solution (preferably TSQL).

I want to code a tsql procedure to restore a database from a backup file (.bak).  The procedure must allow to restore a backup from a database to a different database.

When performing it through the SSMS interface, I see all the files in the .bak file.  From there, I can associate the files in the backup to the appropriate files in my destination database.  when generating TSQL, this translates to MOVE statements for the files.

Can I translate the whole process in TSQL?  In order to know how to map my files, I must first gather the information on which files are present in my bak file.  Can one read the definition of the files contained in a backup file before performing the restore.  Preferably using TSQL?

Change report in VS & deploy.....does NOT overwrite existing report in report manager


I have made some changes to most of my reports that have been previously deployed to report server.  I deploy the changed reports from VS and deployment is successful.  When I run report manager on the server to which they've been deployed, I get the old report.  I have to delete the existing in report manager and redeploy from VS in order to get the updated report in report manager.  This doesn't seem right. 

Am I doing something wrong???



By the way...this doesn't happen all the time.......

Concatenate attribute

I have this query

select code
into #tbl
from people

select * from #tbl
An I get an attribute with several rows.
I want to get one attribute with one row.

example, instead of:


The number of output rows is unknown, so I cannot concatenate them manually.

Can we Replace/Update/Overwrite uploaded document for an item in SP DocumentLibrary?


Hi all, I have a SP Document library item which is holding a document of type .Doc, now i want to Replace/Update/Overwrite the same SP DocumentLibrary's item with other type ex. .Pdf through Sharepoint ObjectModel. Can it be possible. If so can u share ur thoughts/code.

Best Regards, Srikanth Ch

Sharepoint overwriting emails with overwrite turned off


Whenever I email a message directly to sharepoint, it overwrites files of the same name. The incoming email setting is as follows:

Overwrite files of the same name? No.

Is there possibly another setting overriding this one?

Overwrite standard style



I wrote a style-file in my library:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  <!-- Shared colors under all styles -->
  <!-- Border -->
    <ResourceDictionary Source="/Templates;component/Style/Colors.xaml" />
    <ResourceDictionary Source="/Templates;component/Style/Button.xaml" />
The library is Called Templates (namespace)<br/>
The Button.xaml:<br/>
<pre lang="x-c#"><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

  <!-- Button-->

  <Style TargetType="{x:Type 
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