Access :: Combine Items From Two Table Rows Into One View Row?
Working in Access, I need to create a view which takes values from two different records in another table and puts them on one row in the view. I'm having a hard time doing this since both row items come from the same field in the original table (actually in this case, using views instead of tables).
I have two queries I try to join together, but come up with the wrong results:
vwComp1:
SELECT q.CompStatus, q.EQID, c.CompsID, q.LastName, q.FirstNameFROM _EQ AS q, Comps AS cWHERE q.CompStatus=1 AND c.CompsID=q.CompID
vwComp2:
SELECT q.CompStatus, q.EQID, c.CompsID, q.LastName, q.FirstName
FROM _EQAS q, CompsAS c
WHERE q.CompStatus=2 AND c.CompsID=q.CompID
vwAssignment:
SELECT vwComp1.*, vwComp2.*
FROM vwComp1, vwComp2
This does fine in the vwComp2 part of vwAssignment, in the sense that it displays the correct name information, etc.; but for vwComp1, it just takes the name and other fields from the first row of vwComp1 and repeats it on every row of vwAssignment. This is really strange because vwComp1 and vwComp2, when displayed individually, each correctly puts the names in each row; something like this:
Bob White Rhonda Red
Bob White Freda Freschetta
Bob White Linda Lime
Bob White Jean Green
--when it should read something like this:
Bob White Rhonda Red
Fred Redd Freda Freschetta
Jim Brown Linda Lime
Rob Black Jean Green
View 1 Replies (Posted: May 08, 2010 09:44 PM)
Sponsored Links:
Related Forum Messages For ASP.NET category:
SQL Server :: Combine Two Rows Of Data?
have a complex sql stored procedure which involves several unions.The unions also involveat from views. When the data is returned, it might look like the following. ProductId Name Amount Buyer Date YearsAsCustomer 1 Jones 234.44 Nichols 1 Jones 3/12/2011 3 2 Melon 333.00 Tripol 2 Melon 3/23/2011 4 This is just a simple example, but notice how the records with the same product Id can be combined?Because one record has some of the data I need and the other record has different data. So essentiallythey should just be in one record together. So the output should look like this: ProductId Name Amount Buyer Date YearsAsCustomer 1 Jones 234.44 Nichols 3/12/2011 3 2 Melon 333.00 Tripol 3/23/2011 4 How can I combine these records together? In the stored procedure the query is build in a parameter stringnamed @SQL, and then the query is executed by using the EXEC command:EXEC sp_executesql @SQL.Is their anway I can combine all of the outputted records into one record. Where the records I want to combine have the same ProductId (As in the example I illustrated above?)
Posted: Mar 09, 2011 10:27 PM
View 7 Replies!
View Related
Forms Data Controls :: How To Combine Some List Items Together
just want to have a quick question about the value of dropdownlist listitem. I have a gridview which has its datakey value linked to a dropdownlist. In the dropdownlist I have many listitems. So I decided to combine some list items together. Originally, the values of the items are 1,2,3,4,5,6,7,8. But I want to have only 5 items by combining 5,6,7,8 into one listitem called "Others." So if the listitem "Others" is selected, the gridview will show all the records that have value 5 or 6 or 7 or 8. Is it possible? How can that be done? I hope I made myself clear. Any question, I am happy to clarify.
Posted: Jan 08, 2011 01:13 AM
View 4 Replies!
View Related
Forms Data Controls :: Combine Gridview Columns Under One Column And In Separate Rows
I have a couple of things that are not working with my Gridview: 1) I've managed to display 3 columns in one column (see code above) but the data is separated by commas, how can I display each data item in separate rows. 2) How can I make the data unique, as I have added the distinct command which I configured in my SQL data source 3) I need the rows to not display nulls, but at the moment it isn't displaying the row if one of the columns is null? [Code]....
Posted: Nov 29, 2010 08:44 PM
View 3 Replies!
View Related
MVC :: How To Get Access To The Fields In Table B In The View
I do not know if this can be done but lets say have a model like the one below: I am trying to do this: <%= Html.RadioButtonFor(model => model.B.height)%> -----> Does not work. Height is not a property But B is a collection. How do I get access to the fields in table B in the View? *********************************************************** Table A Qid name age Table B Wid Qid gender height
Posted: Feb 09, 2011 06:06 PM
View 14 Replies!
View Related
Access :: Reading Data From Access With A Linked Table (pointing To A Access Table On Another Location?
Here's a short explanation of my asp.net project. 1) the default page loads, it will read the Windows Login of the user opening the page. 2) I'll check if this login exists in a table stored on the webserver. In this Access Database, there's a 2nd linked table, pointing to another access table on a network location. Now, I want to read data from this linked table. However, at this moment I receive an error: "The Microsoft Jet database engine cannot open the file '\<ip><shared-folder>statistics.mdb'. It is already opened exclusively by another user, or you need permission to view its data". Some extra info: - The network folder has read and write permissions for everyone - the user and group permissions on both access files are set to read/modify/administer for the Admin user (on the tables I want to read from) - IIS authentication on the server is set to "Windows Authentication" (this is needed so I can read the Windows Login from the user). All other authentication modes are disables (like anonymous, ...) - When the error occurs, no other program or process has access to the statistics.mdb (so, it can't be locked by someone else) - the web.config files access connection string looks like: <add name="AccessConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\<IP><shared-folder>statistics.mdb;User Id=admin; Password=;" /> Like I said before, in this statistics.mdb file, there are 2 tables. One normal table, and another linked table (pointing to a network location) Searching for solutions, I discovered the following: - if I don't use linked tables, everything works fine (however, I have to use this linked table) - even if I connect directly to the table in the network I receive the error. So, I'm pretty sure I don't have sufficient rights to read from this table. I read that not the Admin user is opening the file, but actually a user called ASP.NET. This user doesn't have the correct rights to do this. However, I'm not sure if this is true.
Posted: Sep 07, 2010 02:03 PM
View 5 Replies!
View Related
Combine Data From Multiple Tables Into One View Model
I'm fairly new to all this, but have slowly been teaching myself C# and ASP.net MVC over the past year or so...I really tried to search for this, but haven't been able to find anything - it may be I'm using the wrong terminology!I'm using ASP.NET MVC2 with EF4 connected to a SQL Express db. Situation: Without getting into too much specifics, I have one table called 'Plan.' Under 'Plan' are several different categories that are related to a single Plan item [say Category A, Category B, Category C and Category D]. Each 'Category X' table has a beginDate, endDate and other details specific to that category. I'd like to be able to create a summary page that combines all items from Category A, Category B, Category C, and Category D and sorts by beginDate - but only need a few of the columns [eg - begin/end date, name, id].
Posted: Dec 5 10 at 7:00
View 1 Replies!
View Related
DataSource Controls :: Combine Two Result Sets From One Table?
I have a table that contains a date column along with others. I need to extract two sets of data from this table for two different time periods. Call them Current and Previous, so that I can compare them line for line. There are exactly the same number of days in both time periods. The problem is that I need to return the data like this: CurrentDate, Count(CurrentItems), Sum(Amt), Count(PreviousItems), Sum(PrevAmt) JOIN puts the data into the result vertically, so that doesn't work. So far, I have not found a method that will arrange the data correctly.
Posted: Jan 06, 2010 08:30 PM
View 1 Replies!
View Related
AJAX :: Adding Table Rows At Specific Point In Table?
I have an asp:Table and around the mid point of the table there is a DDL with values 2-5. What I want to do is add the selected amount of rows using AJAX right after the table row that has the DDL in it. I know how to dynamicly crate the rows, the info in the rows, and how to use AJAX to make things. Problem is I can not put the ContentTemplate tag inbetween the asp:TableRow which would mark the location I want the dynamic rows to start being added. I did some searching on here but most posts I find start with making the table from code and not the asp:Table tag
Posted: Dec 23, 2010 10:58 PM
View 2 Replies!
View Related
SQL Server :: Delete Objects From Table Using Another Table To Select Rows?
I have one table named 'dbo.ac_Products' Within this table there is a column named 'ProductId' There is also another table named 'dbo.ac_CatalogNodes' Within this table there is a column named 'CatalogNodeId' and a column named 'CatalogNodeType' I need to delete all the rows from 'dbo.ac_Products' and 'dbo.ac_CatalogNodes' where 'ProductId' = 'CatalogNodeId' and 'CatalogNodeType' = 1
Posted: Sep 14, 2010 01:23 PM
View 4 Replies!
View Related
Web Forms :: Generate A Dynamic Table And Add Rows To A Table Control?
I am trying to generate a dynamic table andd add rows to a ASP.Net table control on my UI. My problem is as I add a new row from MyTable, in to another table the table I am copying from, will loose one row. Here is the code: Table myTable = new Table (); [Code].... am just reading one row in every loop and add that row in to another table object, why is 'myTable' loosing loosing one row in each loop?
Posted: Mar 29, 2010 04:29 PM
View 7 Replies!
View Related
SQL Server :: How To Update Table Value From Another Table With Limit Rows
I have table a and would like update table a whose values from table b, but not update all rows at table a. Only update record ID in table a match record ID in tableC. Here is my query update a set a.Desc = b.Desc, a.Value = b.Value from TableA a, TableB b where a.name = b.name and a.ID = b.ID and a.ID in ( select ID from TableC) I only have 12 a.ID match TableC, but above query update whole TableA. How to only update 12 record at TableA from TableB?
Posted: Jan 20, 2011 03:01 PM
View 2 Replies!
View Related
Web Forms :: How To Add Same Table Cell To 2 Table Rows
I have two possible header rows for a DataTable that I build dynamically. Setting the value of a cell works fine. Adding the cell to a TableRow works fine. The problem comes in where I have to build a second possible header row that uses the same cell. An example is below. trHead1 = New TableRow trHead2 = New TableRow tcCalc = New TableCell tcCalc.Text = "Rates" trHead1.Cells.Add(tcCalc) trHead2.Cells.Add(tcCalc) As soon as I make the second row add the cell, the cell disappears from the first row. This really doesn't make sense to me but that seems to be the way it is. If there is a work around other than duplicating the lines; tcCalc = New TableCell tcCalc.Text = "Rates"
Posted: Jan 14, 2011 02:50 PM
View 2 Replies!
View Related
Web Forms :: How To Import Exsisting SQL Server Table To Access Table(new Table)
my main intention is that, the exsisting table of sql server database(.dbo) with 1000's of records, that should be import to a new access database table(.mdb).for example if we want to had a new table in db2, of exsisting table in db1 with some conditions by using "select * into New_Tabel from (select * from Exsisting_Table where <Condition>) as objectName". Here the new table is created and records inserted in one execution in db2. The same work should be done for access(sqlserver db --> Access db).Here the new access database table with given name (as string_sysdate) must be created dynamically by clicking a button (multiples time creating new table).Is there any query or c# code for sql server database to access database.
Posted: Dec 10, 2010 12:22 PM
View 2 Replies!
View Related
Forms Data Controls :: Copy Rows From Gridview Selected Items?
have a page that has a results gridview where I have all rows with a chekbox. when I click on the checkbox I try to create an excel filethis is method content: DataTable MyData = new DataTable(); //recorrido sobre los elementos seleccionados6 foreach (GridViewRow row in gvwDbf.Rows) [code]... The problem is that excel file is totally empty. When I trace on the error I find that (item on bold above) dt datable has current record as I expected but Mydata table has nothing inside. shouldn't I use import statement? How can I get the row copied? I intend to have a full table made by every record coming from parameters of each query which is performed inside a for each sentence
Posted: Apr 01, 2011 04:41 AM
View 1 Replies!
View Related
MVC :: Keep Partial View Table In Sync With Main Table?
In a main index view I have several field filters that I am applying using an Ajax form. Then in mypartial view I am displaying the filtered values. Is there a 'nice' way that I can use the same table that I am using for my filters as the table I am using to display my index (essentually I want sizing to take both sets of information into account, and not have to hard code column sizes) [Code].... Partial View [Code]....
Posted: Sep 07, 2009 01:20 AM
View 1 Replies!
View Related
|