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


Top 5 Contributors of the Month
Imran Ghani
Post New Web Links

select of X items in a single field

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :ASP.Net
 
Hi! I've a select like this:select fieldA,fieldBfrom tablebut fieldB must be a list of items of another table:something like this:select fieldA, (select itemA from table2 where idref = table.id) AS fieldB from tableI need to show in fieldB a list of items (X records) returned from my second SELECT with a "-" for separate X fieldsI should show in fielB this:itemA - itemB - item C - item Dis it possible?Thanks


View Complete Post


More Related Resource Links

Need to link multiple External Content List items to a single document metadata column

  
I have an external content list - for my purposes, the data isn't any fancier than a list of terms provided by a web service (read only - I don't need update/delete functionality). I want to be able to link any subset of those terms to a single document metadata column (in other words, I need it to work like a normal content list that is defined to allow multiple values in a column) but SharePoint doesn't let me do that on an ECL. I need the content list to be externally driven since more values are going to be added to an outside system over time, but I think it's possible that I may not need a full-fledged ECL list to make this work this way in SharePoint. Just to clarify: I don't need the metadata values in my documents to maintain a PERSISTENT link to the web service (if someone changes an underlying value in the web service DB, it doesn't need to be updated in the document table too). I just want SharePoint to offer up an updated set of source values from the web service if somebody goes in and edits the document metadata. Any ideas for how I can make this work?

how to convert into a single SELECT

  
I need a query in single "SELECT" and capture all my 3 values into 3 different variables..please help. DECLARE @SourceSystem VARCHAR(100) DECLARE @TransactionType VARCHAR(100) DECLARE @TransactionVersion VARCHAR(100) DECLARE @StrXML XML SET @StrXML = '<PDI_Approval_Message> <Header> <SourceSystem Value="PDI/Workforce" Name="WF"></SourceSystem> <TransactionType Value="Timesheet" Name="WF TS"></TransactionType> <TransactionVersion Value="1.0.0" Name=""></TransactionVersion> <RequestType Value="Submit" Name="Action"></RequestType> <SubmittedOn Value="02/06/2010" Name=""></SubmittedOn> <SubmittedBy Value="AYAZ" Name="hannok"></SubmittedBy> </Header> </PDI_Approval_Message>' SELECT @SourceSystem = x.y.query('data(@Value)').value('.', 'VARCHAR(100)') FROM @StrXML.nodes('//PDI_Approval_Message/Header/SourceSystem') AS x(y) SELECT @TransactionType = x.y.query('data(@Value)').value('.', 'VARCHAR(100)') FROM @StrXML.nodes('//PDI_Approval_Message/Header/TransactionType') AS x(y) SELECT @TransactionVersion = x.y.query('data(@Value)').value('.', 'VARCHAR(100)&#

Tricky SELECT query from a Single Table

  
Hi I have a 2 rows of data in a table as mentioned below   Table1             ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 NULL 40 NULL 20 4 9 2010 400 NULL 200 NULL  I need a SELECT query to get the output in a single row as ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 400 40 200 20 Could anybody help me in writing a query for this? Thanks

How to set items from Select Command in Data Source to populate textboxes

  

I need to know how to get the  items from a Select Command in a Data Source to populate textboxes. For instance in the Select statement below I want to set the textbox for First Name equal to the item in the Select Command highlighted below:

 

 Protected Sub MHGrid_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MHGrid.SelectedIndexChanged
        Me.Table1.Visible = True

        Me.MHFoundation.SelectCommand = "SELECT POPULATION_LIST_ID, FIRST_NAME, MIDDLE_NAME, SSN, BIRTH_DATE, ADDRESS, SPOUSE_NAME, OTHER_ID2, WORK_PHONE, PREFERRED_COMMUNICATION, LAST_NAME, NAME_PREFIX, NAME_SUFFIX, MRN1, CITY, STATE, ZIP, CHILDREN&,OTHER_ID1,POPULATION_TYPE,HOME_PHONE,CELL_PHONE,POPULATION_RATING,NOTES,EMAIL,PERSON_TYPE FROM CHP_POPULATION_LIST "
        Me.txtFirstName.Text = (1)

    End Sub


 


selected option items in (multi-) select box on ASP pages are not highlighted if the select box is d

  

Dear community,

I've an asp application with vbs using input forms containing select objects with the property "multiple" specified. If the select object is disabled, the selected option items aren't highlighted. This behaviour occurs with IE8 and also with IE9. In earlier versions of IE everything worked fine. You can reproduce that also with a simple HTML page like:

<html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
</head>
<BODY>
Disabled:<br><br>

<Select style='width:200;height=200' disabled multiple>
 <option selected>option1</option>
 <option>option2</option>
 <option selected>option3</option>
 <option>option4</option>
 <option selected>option5</option>
</select>
<br><br>
Enabled:<br><br>

<Select style='width:200;height=200' multiple>
 <option selected>option1</option>
 <option>option2</option>
 <option selected>option3</option>
 <option>option4</option>
 <option selected>option5</option>
</select>
</BODY>

<html>


 

Is there a workaround for that?

Thanks in advance!

Juergen


ORDER BY items must appear in the select list if SELECT DISTINCT is specified

  

Hi, i am using a query to get DISTINCT hotels from my Database table sorted by Price and it returns me same hotel times of record found by Price if i use this Query

SELECT distinct(hotelname), availstatus, hoteladdress, hotelphonenumber, hotelpostalcode, destination, starrating, imageurl, hotelcode, TempSession, HotelType, MinimumNightRate from HproTemp where TempSession = '12-53-37' ORDER BY MinimumNightRate

and i get the error "ORDER BY items must appear in the select list if SELECT DISTINCT is specified" When i remove MinimumNightRate from SELECT LIST.

Can anyone have any idea how may i resolve it..


Keep Items in Rectangle on single page

  

Hi all,

I am using SSRS 2005. My report has a table, followed by a rectangle containing textboxes which display the selected parameters for the report.

I would like all the textboxes in my rectangle to always print on a single page - and thought this was the behaviour of rectangle...

However, when i run the report and render to PDF - and, if the number of records in my table takes up a good portion of a page - the text boxes contained in the rectangle can be split over 2 pages.

I do not want to always start a new page for the parameters, only if it cannot fit all together.

Any assitance greatly appreciated.

Thanks, Clay


Items that I select in design view are not being highlighted in source view

  

I'm using Visual Studio 2008, and when I select/highlight something in design view and switch to source view it does not highlight and scroll to the selected item. This makes it really hard to change stuff in source view, and it's very inconvenient at worst. Any ideas? 


How to multi select items in WPF Treeview using Shift Button

  
Hi,

I have a requirement where i have to create a WPF Treeview, bind it to a dataset.
Then i have to provide functionality for user to select nodes either using Ctrl or multi select using Shift button.

I am able to write code to do all the tasks above except multi select using Shift button.
Following is my XAML for Treeview.

<TreeView Name="tvOutput" ItemsSource="{Binding}" Height="200" VerticalAlignment="Top" MouseMove="tvOutput_MouseMove" DragLeave="treeView_DragLeave" SelectedItemChanged="Tree_SelectedItemChanged">
                        <TreeView.ItemContainerStyle>
                                <!-- This Style binds a TreeViewItem to a Node. -->
                                <Style TargetType="{x:Type TreeViewItem}">
                                    <Setter Property="IsEnabled" Value="{Binding IsEnabled, Mode=TwoWay}" />
                                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                                    <Style.Triggers>
                                        <Trigger Property="IsEnabled" Value="True">
                                            <Setter Prop

ORDER BY items must appear in the select list if SELECT DISTINCT is specified

  

why am i getting the error message when both ORDER BY items appear in the SELECT query?

 

Query

SELECT DISTINCT
B.CreatedDate,
BI.DateFrom,
	CONVERT(VARCHAR(8),BI.DateFrom ,3) as FFromDate,
	CAST(FLOOR( CAST( BI.DateFrom AS FLOAT ) ) AS DATETIME) as FromDate,
	CONVERT(VARCHAR(8),B.CreatedDate ,3) as FBookingDate,
	CAST(FLOOR( CAST( B.CreatedDate AS FLOAT ) ) AS DATETIME) as BookingDate,
	P.BookingRef,
	P.PaymentTypeCode,
	(C.Forename + CASE 

Select statement with two group level to create addtional field.

  

Here is an example of my question

I have  a column called Department, a column called Employee Name and a column called EmployeeAbsent.

Obviously i can easily use a select satement to get each employee's absent status. However, I would like to generate an additional field called DepartmentAbsent to see if anyone in a particular depart is absent based on the EmployeeAbset field.

how should I write the query?


Is it possible to save "Collections" to a single varbinary(MAX) field/column in a SQL Server 2008 da

  

I was thinking about the fastest way to retrieve a "set" of objects related to a specific user. For instance, if I was to create a website similar to Flickr where people upload lots and lots of photos(jpegs) what would be the fastest way to be able to retrieve those photos from the SQL Server database. Scenario 1: You store metadata about each file they upload to the website as a single row in a database table. Then when you want to retrieve a specific users uploaded files you simply scan the database file for every row matching the UserID and store them in memory.

SELECT PictureId, UserId, PathToFile, Caption, (etc.)

FROM Photos

WHERE UserId=@UserId

This, of course, gets all the information about all the photos a single user has uploaded. My concern with this approach is when the user activity goes from a few thousand to being in excess of a million.

This approach seems fine for a small website but does this method work for a million plus user website like Flicker or MySpace? When you have a million users and millions more photos does this approach still perform at acceptable speeds?

My idea was to actually attempt to create a collection in memory of "ALL" the PictureIds' for a single user and store them in-memory, in a collection and then save this collection as a single VARBINARY(MAX) field in the SQL

Type in first few characters to select items in a large list quicker

  
is there a way that you can type in the first few characters of an item in a dropdown box eg if you type ‘rad’ in the dropdown box it will take you to the first item starting with ‘rad’.

Is it possible that you could type in rad to get you to radiator for example?


select specific field from DB

  

how to select  a specific field data from DB

using  HQL   ,  working with Nhibernate    with C#.net


select particular field from xml file

  

Hi friends this is my xml file


<?xml version="1.0" encoding="utf-8" ?>
<Employees>
  <Employee>
    <Id>100</Id>
    <Name>arun</Name>
    <Dept>Electrical</Dept>
    <dtdate>12-05-2010 </dtdate>
  </Employee>
  <Employee>
  <Id>101</Id>
  <Name>Aji</Name>
  <Dept>Computer</Dept>
    <dtdate>13-05-2010 </dtdate>
  </Employee>
  <Employee>
  <Id>102</Id>
  <Name>Kiran</Name>
  <Dept>civil</Dept>
    <dtdate>14-05-2010 </dtdate>
  </Employee>

</Employees>


i want to display records of employee with id=100.


i tried this example

XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.Load(Server.MapPath("Employee.xml"));
        DataSet ds = new DataSet();
        ds.ReadXml(xmlDoc.SelectNodes("//Employees//Employe

Need to link multiple External Content List items to a single document metadata column

  

I have an external content list - for my purposes, the data isn't any fancier than a list of terms provided by a web service (read only - I don't need update/delete functionality). I want to be able to link any subset of those terms to a single document metadata column (in other words, I need it to work like a normal content list that is defined to allow multiple values in a column) but SharePoint doesn't let me do that on an ECL. I need the content list to be externally driven since more values are going to be added to an outside system over time, but I think it's possible that I may not need a full-fledged ECL list to make this work this way in SharePoint.

Just to clarify: I don't need the metadata values in my documents to maintain a PERSISTENT link to the web service (if someone changes an underlying value in the web service DB, it doesn't need to be updated in the document table too). I just want SharePoint to offer up an updated set of source values from the web service if somebody goes in and edits the document metadata.

Any ideas for how I can make this work?


Filtering SPGridView By Single Value In MultiChoice or MultiLookup Field

  

I created  a web part using an SPGridView. Everything works fine, but I'm curious if it's possible to filter by a single value of a field containing multiple values.

For instance, I have a MultiChoice column whose values are stored internally in SharePoint as something like this:

One#;Two#;Three

I can apply a filter to this column, but doing so doesn't result in the ability to filter by a single value like I want. For example, I'd like the following to be filter values:

  • One
  • Two
  • Three

...but instead the available filter values match what's stored internally in the field, unparsed. In other words, I only have the option to filter by the value:

"One#;Two#;Three"

Is there a way to set up the SPGridView such that I can have the sort of filtering I want?

 


Categories: 
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