ASP.NET - How to uppend

Asked By msakt on 07-Jun-12 08:33 AM
S = 1,2,3,4;

s1 = 1,5,2,6,7;


now i wnt to append  s2 = 1,2,3,4,5,6,7;
C D replied to msakt on 07-Jun-12 09:01 AM

Hi Frndz,

 

Functionality ::  Concate two string and Remove Duplicate

 

Take to string into array. And split with comma seperator.

 

After then using linq to remvoe duplicate

 

LINQ Query ::

 

 

 

string S = "1,2,3,4";

        string S1 = "2,4,5,6";

 

        string[] arrstr = S.Split(',');

 

        string[] arrstr1 = S1.Split(',');

 

 

        var result = arrstr.Concat(arrstr1).GroupBy(x => x.ToString()).Select(x => x.First()).ToList();

 

 

        string S2 = "";

        foreach (var item in result)

        {

          S2 = S2 + "," + result;

        }

        S2 = S2.TrimStart(',');

 

 

Hope this helpful!

Thanks

 

Jitendra Faye replied to msakt on 07-Jun-12 10:10 AM
Use this working code-

        string s1  = "1,2,3,4";
        string s2 = "1,5,2,6,7";

      
  s1 = s1 + "," + s2;

        string[] arr = s1.Split(',');

        string result = "";
        foreach (string s in arr)
        {
          if (!result.Contains(s))
          {
            result = result + s + ",";
          }

        }
        result = result.Substring(0,result.Length - 1); 

output-

1,2,3,4,5,6,7

Try this and let me know.

TSN ... replied to msakt on 08-Jun-12 01:20 AM
   
HI.....

Just use simple Unoin , it will take care of the duplicates by itself

 int[] arr1 = { 1,2,4,6};
    int[] arr2 = { 3,2,6,5 };

    var arr3 = arr1.Union(arr2);

    foreach (int n in arr3)
    {
      Console.WriteLine(n.ToString());
    }
 
help
have a table with 3 fields to be used in a crosstab query: PersonID GroupID ConCat RowHeader: Person ID ColumnHeader: GroupID Value: ConCat The problem is that ConCat is a MEMO field because it has more than 255 characters. Is there a way crosstab query? Thanks David Access Queries Discussions PersonID (1) GroupID (1) ColumnHeader (1) RowHeader (1) GroupBy (1) ConCat (1) MEMO (1) The wizard won't let you do this, but it you create a query, go to the query type button and turn it into a crosstab, choose GroupBy (in the Totals row) and RowHeader (in the Crosstab row) for PersonID, GroupBy and ColumnHeader GroupID with First and Value for ConCat. Evi query? keywords: Crosstab, query, with, notes description: I have a table with 3 fields
After then using LINQ concept Remove Duplicate value and Get Unique Value var result = (arrstr.Concat(arrstr1)).GroupBy(g = > g.ToString()).Where(g = > g.Count() = = 1).Select(x = > x.Key).ToList(); Logic : string 4" ; string S1 = "1" ; string [] arrstr = S.Split( ', ' ); string [] arrstr1 = S1.Split( ', ' ); var result = (arrstr.Concat(arrstr1)).GroupBy(g = > g.ToString()).Where(g = > g.Count() = = 1).Select(x = > x.Key).ToList(); string S2 net / post / ASP-Net-C-sharp-String-Compare-Function.aspx keywords: ASP.NETLINQ, RemoveAll, TrimStart, GroupBy, ToArray description: compare string value string s = 1, 2, 3, 4, 5, 6, 7, 8
Hi, try the below queries. . select distinct * from tableName inner join where date = max(date) groupby accountnumber try one of the following 1. use Distinct in your query, it removes the All the Best. . !! Rakesh Vikram you can use distinct keyword for that. . you have to concat the fields which you are getting as duplicate and write them in distinct. . . like select
AS sp) select @output = convert(nvarchar(max), @node_data.query('for $val in / sp:DefinedValue return concat(($val / sp:ColumnReference / @Column)[1], " = ", ($val / sp:ScalarOperator / @ScalarString)[1], ", ")')) declare @len int select @len AS sp) select @output = convert(nvarchar(max), @node_data.query('for $col in / sp:OrderByColumn return concat(if (($col / sp:ColumnReference / @Alias)[1] > "") then concat(($col / sp:ColumnReference / @Alias)[1], ".") else if (($col / sp:ColumnReference / @Table)[1] > "") then concat(($col / sp:ColumnReference / @Table)[1], ".") else "", string(($col / sp:ColumnReference / @Column)[1]), if ($col / @Ascending AS sp) select @output = convert(nvarchar(max), @node_data.query('for $op in . / sp:ScalarOperator return concat(string($op / @ScalarString), ", ")')) declare @len int select @len = len(@output) if (@len > 0) begin select 07 / showplan' AS sp) select @output = N'Bitmap(GROUP BY:(' + MS_PerfDashboard.fn_ShowplanBuildColumnReferenceList(@node_data.query ('. / sp:GroupBy / sp:ColumnReference'), 0x1) + N')' return @output; end go if OBJECTPROPERTY(object_id ('MS_PerfDashboard.fn_ShowplanFormatComputeScalar'), 'IsScalarFunction') = 1 exist('declare namespace sp = "http: / / schemas.microsoft.com / sqlserver / 2004 / 07 / showplan"; . / sp:StreamAggregate / sp:GroupBy') = 1) begin ;WITH XMLNAMESPACES ('http: / / schemas.microsoft.com / sqlserver / 2004 / 07 / showplan' AS sp) select @output = @output + N'GROUP BY: (' + MS_PerfDashboard.fn_ShowplanBuildColumnReferenceList(@node_data.query ('. / sp:StreamAggregate / sp:GroupBy / sp:ColumnReference'), 0x1) + N')' select @need_comma = 0x1 end ;WITH XMLNAMESPACES ('http: / / schemas.microsoft.com / sqlserver
CA / / Je concatene ma cle region et ville MethodCallExpression cle = Expression.Call(typeof(String).GetMethod("Concat", new[] { typeof(string), typeof(string), typeof(string) }), new Expression[] { region, Expression.Constant(_Separateur), ville }); LambdaExpression enregistrement = > Convert.ToDouble(enregistrement[2])).ToString() }); Autant faire un code du style : var cible2 = listEnregistrement .GroupBy(expresionGroup) .Select(expresionGroup); et d'affecter dynamiquement expresionGroup et le expresionGroup en fonction de tes
could do it: xmlfile.Elements("item").Select(i = > new { product = i["Product1"], Qty = i["Qty"] }) .Concat(xmlfile.Elements("item").Select(i = > new { product = i["Product2"], Qty = i["Qty"] }) .GroupBy(i = > i.product).Select(g = > new { g.product, g.Sum(i = > i.Qty) }) I'm item") .SelectMultiple(i = > new { prod = i.Product1, = i.qty }, new { prod = i.Product2, i.Qty }) .GroupBy(i = > i.Prod).Select(g = > new { Prod = g.Key, Qty = g.Sum(i = > i.Qty new[] { selector1(x), selector2(x) }); You can use SelectMany if you like, you can use Concat. SelectMultiple is just another way to do it. It avoids the need to create an
ColumnReference Database = "[KVP_DB]" Schema = "[dbo]" Table = "[Sitzung]" Column = "Dauer" / > < / Identifier> < / ScalarOperator> < / Aggregate> < / ScalarOperator> < / DefinedValue> < / DefinedValues> <GroupBy> <ColumnReference Database = "[KVP_DB]" Schema = "[dbo]" Table = "[Kostenstelle]" Column = "Abteilung_ID" / > < / GroupBy> <RelOp NodeId = "1" PhysicalOp = "Sort" LogicalOp = "Sort" EstimateRows = "1.00124" EstimateIO = "0.0112613" EstimateCPU = "0 ColumnReference Column = "Expr1055" / > < / OutputList> <RunTimeInformation> <RunTimeCountersPerThread Thread = "0" ActualRows = "3886" ActualEndOfScans = "1942" ActualExecutions = "1943" / > < / RunTimeInformation> <Concat> <DefinedValues> <DefinedValue> <ColumnReference Column = "Expr1053" / > <ColumnReference Column = "Expr1048" / > <ColumnReference Column = "Expr1051" / > < / DefinedValue> <DefinedValue> <ColumnReference Column RunTimeInformation> <RunTimeCountersPerThread Thread = "0" ActualRows = "1943" ActualEndOfScans = "1942" ActualExecutions = "1943" / > < / RunTimeInformation> <ConstantScan / > < / RelOp> < / ComputeScalar> < / RelOp> < / Concat> < / RelOp> < / MergeInterval> < / RelOp> <RelOp NodeId = "23" PhysicalOp = "Index Seek" LogicalOp = "Index Seek" EstimateRows = "1" EstimateIO
please Phil I doubt you can edit the cross tab query as it has a groupby clause. Maybe save it to a table (MakeTable) query, add another field to it using AlterTable (see Help topic), then run someroutine like the below Public Sub Concat() Dim r As Recordset Dim s As String Dim iFC As Integer 'substitue Table1 with
Hi The command String::Concat(. . . . ) seem not to be in the standard commands setting. Which snapin do I need to 1) TypeNameOfValue (1) System.Object (1) System.Objec (1) IsInstance (1) MemberType (1) Params (1) Concat (1) If Concat() is a static method of the System.String class, then what you want is probably [string]::Concat() or [System.String]::Concat() (they are both the same thing) None. System.String is a built in type so the concat method is there: PS D: \ Users \ tfl> [system.string]::Concat MemberType : Method OverloadDefinitions : {static string Concat(System.Object arg0), static string Concat(System.Object arg0