C# - Concatenate Different Values From A Specific Column To A Same Line

Jan 18, 2011

I Have a DataTable with a lot of Rows and Columns.

Some of these Rows have the Same "OrderId", actually these rows are almost the same, but I have a specific value in the "TagList" Column that I have to put in the previous row.

Making a unique Row with all the TagList values inside the TagList Column.

I'll give a example below:

Line 1:
ID: 1
Name: John
OrderId: 1500
TagList: AG75

Line2:
ID: 2
Name: John
OrderId: 1500
TagList: BG99

I wanna do it:
Line:
ID: 1
Name: Mark
OrderId: 1500
TagList: AG75, BG99

ie: Concatenate the TagList's values when they have the same OrderId.

View 1 Replies


Similar Messages:

How To Update Particular Column Values Of Gridview On Specific Dates Using Vb.net

Dec 17, 2010

I have column in database

ID From To s1from s2to s2price fare

1 Delhi Manali 17-Dec-2010 19-Dec-2010 $900 $600
2 USA Canada 18-Dec-2010 20-Dec-2010 $500 $800
3 Newyork salinas 19-Dec-2010 22-Dec-2010 $760 $1000

I want when any user search For: Delhi to Manali on between 17-Dec-2010 to 19-Dec-2010 then the price would be automatically changes to $900 in gridview else the default price wold be displayed in fare is $600 if he search for DelHi to Manali after 19-Dec-2010.

I m confused how to implement this logic ... using vb.net ...

View 1 Replies

Web Forms :: Concatenate Checkbox Value And Textbox Value Into One Column?

Jun 16, 2010

I made a thread about getting all values of checkbox in my database, fortunately it was an easy task. I have 12 list items and the last item is "Others, specify:", wherein there would be a textbox near it for input. Obviously, it will be use to make additional data that is not included in the list.

Here's it is:

[Code]....

I made my server side code to concatenate multiples values that will be sent into my database from the user's checked items. Here it is:

[Code]....

My question is, how could I concatenate the inputted values that would be made by user on the textbox to the checkbox column on my database. I'm thinking like this:

[Code]....

Now if this is a decent method, then I would like to ask how could I set a parameter on otherattainment.Text without making a new column for it in my database. Obviously to avoid SQL Injection.

EDIT:

I just put cmd.Parameters.Add("@Others", SqlDbType.NVarChar).Value = otherattainment.Text; above, I believe this setting of parameters is only applicable if only the element will be included in the SQLCommand query and or in the database. Do you think that it has been set to parameters by adding this?

View 5 Replies

SQL Server :: How To Concatenate The Row Values

Jul 30, 2010

I want to concatenate the row values in field.I am having 123 rows in one column.So i have to insert those 123 row values into 123 column values.

For that I used cursor now i m getting the result like this

1000,
2000,
3000,

So i want this values in one row so that i can write that in insert query to insert those values in other table as multiple column values.

View 1 Replies

Concatenate Two Session Values In Web Application?

May 10, 2010

concatnate two session values. I need to concatnate

Session["probmgremail"].ToString();and Session["TextBox2"].ToString();

The output should be a combination of two values seperated by a semicolon(;).

The session values are email address.

View 2 Replies

ADO.NET :: Convert SQL Concatenate To LINQ Concatenate Query?

Oct 20, 2010

convert the code below to LINQ, converting my project to a wseb version usimg LINQ To SQL. The project contains 10 textboxes to possibly select from, but I'm only providing the first two textboxes to simplify my question.

mySQL_Statement = "SELECT IDENTIFICATION_DATA.NSC,ITEMISCD.RNC,ITEMISCD.NSC1 FROM IDENTIFICATION_DATA LEFT OUTER JOIN ITEMISCD on IDENTIFICATION_DATA.NIIN = ITEMISCD.NIIN"
If Not ((TextBox1.Text = String.Empty) And (TextBox2.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + " where "
If Not (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + "IDENTIFICATION_DATA.NSC IN (" + TextBox1.Text & ")"
End If
If (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + "isnull(IDENTIFICATION_DATA.NIIN) = FALSE"
End If
If Not (TextBox2.Text = String.Empty) Then
If astrixState = 0 Then
If Not (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + " AND IDENTIFICATION_DATA.NIIN IN (" + TextBox2.Text & ")"
ElseIf (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + " AND IDENTIFICATION_DATA.NIIN IN (" + TextBox2.Text & ")"
MsgBox(mySQL_Statement)
End If
End If
If astrixState = 1 Then
If Not (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + " OR IDENTIFICATION_DATA.NIIN IN (" + TextBox2.Text & ")"
Else
mySQL_Statement = mySQL_Statement + " AND IDENTIFICATION_DATA.NIIN IN (" + TextBox2.Text & ")"
End If
End If
If astrixState = 2 Then
If Not (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + "AND IDENTIFICATION_DATA.NIIN NOT IN (" + TextBox2.Text & ")"
Else
mySQL_Statement = mySQL_Statement + " AND IDENTIFICATION_DATA.NIIN NOT IN (" + TextBox2.Text & ")"
End If
End If
End If

View 12 Replies

DataSource Controls :: Accessing Specific Column In Database With Column ID With Table Adaptor

Jan 6, 2010

I'm currectly tryin to access a specific value in my database in a specific column. I'm tryin to use the primary key of the table to access the actual value in the row of that ID.

The current code:

[Code]....

Just iterates through the table and looking for any row with the boolean 'checkin' value is True, then it takes the 'id' value of that row and stores it into an array. Is there a way that I can access a another entry, and only that entry, in the table with the 'id' stored in the array?

Like if my data base contained and int, primarykey, `id` value, a boolean, `checkedin` value, and a `time` value, is there a way to access, lets say, the row with `id` equalling 3 and and the checkIn value from that row?

View 2 Replies

Write To Specific Line In Text File C#?

Jun 30, 2010

I have a web app that I am developing at work. I need to be able to take input data and append a text file after (x) number of lines.

My web app is using asp.net with c#

View 3 Replies

Web Forms :: Read Specific Line Of Multiline Textbox?

Dec 12, 2010

How do I just get the first line of a multiline textbox? Either that or delete everything after "<br/>"? I tried something like this but it doesn't work:

MyTextBox.Text.Replace("<br/> + '%'", "")

View 1 Replies

Forms Data Controls :: Add An Empty Line In Gridview On Specific Day Of Week?

Aug 17, 2010

Havin quite a bit of trouble with this one. I have a bunch of days that I worked in my database...mostly monday-friday and some saturdays. What I want the gridview to do is add an empty line between each sunday and monday so that it seperates out my work weeks and makes it easier to read in the gridview. I got some help here a few days ago on how to clone the db etc and I have all that working properly but I can't seem to wrap my head around how to do add these empty lines in the proper spots. Here is my code so far:

[Code]....

What ends up happening is since I "seed" a variable with a specific date, the empty space inserts start getting off by a few days after awhile. I know why this happens but I'm not sure how to fix it.

View 13 Replies

SQL Server :: Update Column Into Identity Column By Removing Null Values?

Aug 10, 2010

I have a table converted from Access and the identity keys were lost. Now I need to make the id column the identity column, but it already has a lot of null values, how do I auto generate integer values for the null rows? The row ids are incremented, so if there is a way to auto increment the ids

View 7 Replies

Forms Data Controls :: Making Visible Of Gridviwe Column If All Values In Selected In A Column Is Not Null

Dec 30, 2010

I have gridviwe having 2 columns:

1) DocNumber 2)Title

query select docnumber,title from tbl_docs.

BindwithGridviwe(sql);

Now the issue is that that every document doesn't has document number. I want to make invisible the docuNumber column of the grid viwe if all values in the docNumber retrieved are null.for example:

docnumber tite
null Document 1

null Document 2

null doucment 3

null document 4

if returned result match above where all docnumber are null then make the gridviwe docnumber column ivisible eslemake the greidviwe column visible.

View 4 Replies

DataSource Controls :: Move 1 Column Values To Another Column In Datatable?

Mar 31, 2010

i have a datatable with several columns and rows. now i want to copy the last column fully (all rows) and create the new column with that values.

it means last column values sholud be moved to new column (now this is the last column).

View 2 Replies

Forms Data Controls :: Gridview Column Line Wrap

Oct 11, 2010

I have a ASP.NET gridview (embedded into a DIV) with several columns. For some columns line wraps are definied and for some not(with ItemStyle.Wrap = true/false). For all columns ItemStyle.Width is set to a specific value. Now I am wondering, that there is a line wrap in a column, where ItemStyle.Wrap = false. What could be the reason for that?

View 1 Replies

C# - Sorting Specific Column In A GridView After A DataBound?

Feb 9, 2010

I have given an access to stored procedure, which i'm not able to edit. This Stored Procedure returns a Table with 2 Column, what I did is set a GridView's DataSource using SQLDataSource in this stored procedure. but I want this GridView to Sort an specific column to descending whenever this GridView Loads.

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource2" ForeColor="Black"
Width="58%" Height="125px" AllowPaging="True" AllowSorting="True"
PageSize="5" >
<Columns>
<asp:BoundField DataField="DateOccur" HeaderText="Login Date"
SortExpression="DateOccur" />
<asp:BoundField DataField="TotalMinutesPlayed" HeaderText="Total Minutes"
SortExpression="TotalMinutesPlayed" />
</Columns>
<AlternatingRowStyle BackColor="#EFEFEF" />
</asp:GridView>

View 2 Replies

How To Add Data Into A Specific Column At Runtime In Grid

Dec 9, 2010

I have a rad grid, i have bounded the columns in the grid using GripBoundColumns which shows me dropdown cloumns when i edit the record, Insert/update/delete are working fine for me.

My question is it possible to insert new data into the column(Not the whole record just only to one column) when i edit the record.

For example...

suppose i have 5 columns (Client Name, Account No, Account name, account status, Custodian Dealer) CustodianDealer is my drop down coloumn and data for it comes from different table when i edit or insert a new record in the grid, i can select the existing Custodiandealers in the table.

now if i want to insert a new record to the custodianDealer table not to the grid, how can i acheive it

View 3 Replies

Can Write A Selector For Specific Column Of GridView

Apr 4, 2011

how can i write a selector for specific column of GridView ?

i want to do something on mouseover of a GridView Column. and i want to do it once.

Here is my gridview :

<asp:GridView AutoGenerateColumns="False" Width="100%" ID="grvUsers" runat="server">
<Columns>
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# eval("ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Html Output :

<table cellspacing="0" rules="all" border="1" id="grvUsers" style="width:100%;border-collapse:collapse;">
<tr>
<th scope="col">Delete</th>
</tr><tr>
<td>
<span id="grvUsers_Label1_0">23</span>
</td>
</tr>
</table>

GridView DataBound

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dr As DataRow
Dim dt As New DataTable
dt.Columns.Add("id")
dr = dt.NewRow
dr(0) = "23"
dt.Rows.Add(dr)
grvUsers.DataSource = dt
grvUsers.DataBind()
End Sub

View 1 Replies

C# - Passing Null Values In Single Line Conditional?

Oct 15, 2010

Just a fictional code, but why this won't work? (as the date variable is nullable)

DateTime? date = textBoxDate.Text != "" ? textBoxDate.Text : null;

The error is "There is no explicit conversion between System.DateTime and <null>

View 4 Replies

Forms Data Controls :: Way To Format Gridview By Creating New Line In A Single Column

Feb 4, 2010

I am creating a Data Tabel in code behind and binding it to Gridview. I am trying to format by creating new line in a single column. Here is the code:

row("Employee Name") = empName + ("<br/>" + empTitle
GridView1.DataSource = myDataTable
GridView1.DataBind()

View 3 Replies

SQL Server :: Split Sentences At Line Break Then Insert In Database Each Separate Column?

Jul 15, 2010

I would like to know if someone can please help me with the followingI would like to create a bulk entering textbox...every sentence seperated by a line break should go in to the Database as a new column.....Im gonna use SqlDatasource for the inserting..How can I get all the sentences to break up at the linebreak and then get inserted in a separate database column?

View 3 Replies

Forms Data Controls :: Get The Specific Column Value From Gridview?

Jun 23, 2010

get the specific column value from gridview.

View 5 Replies

C# - Make A Specific Column Editable Upon Clicking Edit?

Jan 22, 2011

I have a gridview with "Edit Update Cancel" command field. When I click Edit, all the columns in the particular row becomes editable. I just need to have 2 specific columns editable. How is that made possible ? (Screen Shot Attached) [In the screen shot all 3 columns are editable, I just need the second and third to be editable]

View 2 Replies

C# - Allow Some Specific Character From Long Text In Telerik Column?

Jul 20, 2010

I have an aplication in asp.net MVC and using telerik grid for displaying the record. Now one of my field has some large text about 1000 character due to which the text is getting extended vertically and layout is not looking good.

Is there any way to show some specific number of character in the column and show the whole text in a tool tip on mouse hover or any other way to show the complete text for that column.

View 2 Replies

Forms Data Controls :: Get A Value In A Specific Row And Column Of A Gridview?

Feb 16, 2010

How do you get a value in a specific row and column of a gridview assigned to a variable ?

View 2 Replies

Data Controls :: How To Hide Specific Column Of GridView

Jun 25, 2013

I have 5 column, in first two column read only id in hidden field, but in UI first two column shows empty,this two column in UI does not show only show remaining three column, then how to hide first two column using css ...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved