Master - Details In Reverse

Mar 20, 2006

HI, I'm using Visual Web Developer and SQL Server 2005 Express Editions. I have a database with two tables, say AccountsTable and PersonsTable, with a one to many relationship respectively.

Given a particular selected record in PersonsTable, I need to look up the corresponding master record in AccountsTable. Here's what I've done:

SqlDataSource1 has a "SELECT * FROM PersonsTable" and a GridView1 which uses this as its datasource and the 'enable Selection' checkbox is On. This works fine.

Then, I create a second SqlDataSource2. When I click on the WHERE button in the Configure Data Source page, I have chosen the following parameters:

Column:PrimaryKeyField; Operator:=; Source=Control; ControlID=GridView1; Default Value='I left this blank' but the Value field shows GridView1.SelectedValue when I click the ADD button.

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:bizConnectionString %>"

SelectCommand="SELECT * FROM [AccountsTable] WHERE ([AccountNumber] = @AccountNumber)">

<SelectParameters>

<asp:ControlParameter ControlID="GridView1" Name="AccountNumber" PropertyName="SelectedValue"

Type="Int32" />

</SelectParameters>

</asp:SqlDataSource>



I have bound DetailsView1 to SqlDataSource2. When I run the page, the GridView1 is shown with Persons records OK. Then I click the 'Select' next to a record in the Gridview expecting the corresponding lookup to the master record (Account) to be shown in the DetailsView, but it does not show anything.

What am I doing wrong? Is there a better way of doing this?

Your help is much appreciated. Thank you.

PS. I could find Tutorials showing Master/Details retrieving records in a top down fashion (1:n), but I could not find the reverse (n:1)

 

View 6 Replies


ADVERTISEMENT

Master Information And Details: How Can I Get The Master ID?

Jun 19, 2007

I got a File with sales orders and their details.

Step 1. First I am filtering the Sales Order information and inserting it in my Sales Orders table.
Step 2.Then I am filtering the details from the sales Order and inserting them in the respective table.

My Problem is that the Sales Order File does not contain the Sales Order key (ID), this is generated by the SQL Server. How can get it in order to use it in the second step? I need it because it is a foreign key in the details table.

Any Idea?


View 4 Replies View Related

Master-Details Insert

Jan 21, 2007

Master table (tlbProduct) having productID as Primary key and which acts as reference key for table (tlbCategory).Fields for tlbProduct are productID,productNameFields for tlbCategort are productID,CategoryID(primary key),CategoryName,Prizeboth productID,CategoryID are autoincrementing.but when i write two inserts simultaneously as follows insert into tlbProduct(productName)values(@productName)insert into tlbCategory(CategoryName,Prize) using sqldatasourceI get the error that ProductID value is null which is not providedBut (productId in both is autoincremented) and relationship is there in both tables How to resolve this problem without adding ProductID in second Insert?SWati 

View 1 Replies View Related

C# Master-Details (Separate Pages)

Jan 25, 2006

My question is setting up master detail pages using stored procedrues.  In the tutorials C# Master-Details (Seperate Pages) example they use the following code for the master page for the navigation.
          <asp:HyperLinkField HeaderText="View Details..." Text="View Details..." DataNavigateUrlFields="au_id"            DataNavigateUrlFormatString="DetailsView_cs.aspx?ID={0}" />
The call to the Details Page DetailsView_cs.aspx uses the following code
 <asp:SqlDataSource ID="SqlDataSource1" Runat="server" SelectCommand="SELECT dbo.authors.au_id, dbo.titles.title_id, dbo.titles.title, dbo.titles.type, dbo.titles.price, dbo.titles.notes FROM dbo.authors INNER JOIN dbo.titleauthor ON dbo.authors.au_id = dbo.titleauthor.au_id INNER JOIN dbo.titles ON dbo.titleauthor.title_id = dbo.titles.title_id WHERE (dbo.authors.au_id = @au_id)"        ConnectionString="<%$ ConnectionStrings:Pubs %>">        <SelectParameters>          <asp:QueryStringParameter Name="au_id" DefaultValue="213-46-8915" QueryStringField="ID" />        </SelectParameters>      </asp:SqlDataSource>
I can replicate the example calling the detail page but I am unable to make the detail page work when using a stored procedure as the asp:SQLDataSource. Using the above sql code as a stored procedure in the  <SelectParameters>  I am not able to return the data set using either asp:QueryStringParameter or asp:Parameter as I have built other forms using stored procedures and have tested the procedure and know that it works. Can someone point me in the right direction.
Thanks
 
 

View 2 Replies View Related

How Do I Delete Master Details Records.

May 22, 2001

i have go master records as well child records
how do i delete all the master records so that all
my corresponding child records get deleted ,as we do in
oracle using undeleted cascade

please help me

manas

View 1 Replies View Related

Item Master And Office Stock Details (was Query Problem)

Sep 15, 2006

Hi,

I am having problem in getting result out of two table, one table is Item Mater which stores global items for all offices and other is stock file which stores office wise stock items as follows:

ITEM MASTER
--------------
NCODE ITEMNAME
1 A
2 B
3 C
4 D
5 E

STOCKDETAILS
-----------------------------------
NCODE ITEMCODE OFFICEID
1 1 1
2 2 1
3 3 1
4 1 2
5 2 2
6 4 2
7 5 3

I want office wise stock details which inludes items found in stock file and remaining itmes from item master. example for office 1

--------------------------------------------
FOR OFFICE - 1
--------------------------------------------
ITEMCODE ITEMNAME OFFICEID
--------------------------------------------
1 A 1
2 B 1
3 C 1
4 D NULL
5 E NULL

i want a single view from which i can select data like i shown above, any kind of help is highly appriciated, what i tried is , i created union of both tables and tried to get data out of union view but result is not up to desire.

Thanks in advance

View 8 Replies View Related

HOW TO SELECT ROWS IN THE MASTER TABLE WITH NO RELATIONED DATA IN DETAILS TABLE

Dec 7, 2007

I have the following data

MASTER
id
name


DETAIL
id
master_id
name

I want a perform a query where i can get all the rows of the master table which have no relationed rows in detail table.

How can I do that???

View 1 Replies View Related

Reverse Equivalent To TOP

Dec 28, 2006

Is there anyway I can return only the last row of a query, like TOP does for the top most items?I would like to return something like this:SELECT BOTTOM 1 Column_CFROM Table1WHERE Column_A = somethingAny help would be greatly appreciated.  Thank you!  

View 3 Replies View Related

Reverse Engineer

Aug 10, 2000

1. Is there a stored procedure, or a way to reverse engineer a database in SQL Server 6.0?

2. I need to create a recovery system for all datbases. I know SP_HELP_REVDATABASE dbname
works for sql server 6.5 but does not for sql server 6.0

Thanks
Rajiv

View 1 Replies View Related

Reverse Engineering SPs

Mar 8, 1999

Does anyone know of a way to determine the code of a stored procedure that was built with encryption? I inherited a db with many of these and we are not sure which version of the source code exists on the server. Alternatively, can I compile a new SP and compare it to the old one in any way other than testing lots of data?

thanks in advance.

View 1 Replies View Related

Reverse Order By?

Mar 28, 1999

If I want to query the db and pull the records in reverse how can I do that?

Here, It looks something like this.

sql = " SELECT "
sql = sql & "ID, from_, subject, comments, "
sql = sql & "msgtime, msgdate, repto, followups "
sql = sql & "FROM " & TABLE_NAME & ""
sql = sql & " WHERE (repto < 1);"
sql = sql & " Order by ID" <-I want to get this starting with the largest ID #

Any Idea's?
Thanks in advance.
Mike

View 1 Replies View Related

Reverse Cross Tab

Feb 19, 2002

Is is possible to write a query that does the reverse of a cross tab query, I have a table that is mirrored for our Main frame, the table contains a item number a warehouse number and a date field and then 43 fields like field01 thru field43 which store quantities, each field out from 01 is another date our from the date field and I need to look for the item, warehouse and return a date where one of the many field is greater than or equal to the quantity I am looking for, I obviously will have to calculate the date field but thought If I could do the reverse of a cross tab giving a resuld set of 43 records for everyone in the first file I could do a quick update for item number, warehouse match and quantity field greater than what i need returning the date

blah blah blah , sorry I made it sound so confusing

THANKS IN ADVANCE

View 2 Replies View Related

Reverse Formula

Feb 12, 2008



Hi . My database seems to be somehow encrypted by the software I used. When I try to export my data some fields are encrypted like this:


1 => 31911
2 => 63758
3 => 95540
4 => 127258
5 => 158912
6 => 190504
7 => 222032
8 => 253498

I'm really sure it's not some complicated formula (because I managed to recover other fields) . I just want to reverse the formula used to "encrypt" this data.
Thank you. Excuse my english.

View 1 Replies View Related

Can You Reverse A MSDE Install Over SQL 6.5?

May 23, 2000

I have a friend who has installed MSDE over SQL Server 6.5 - by doing so he broke some other apps that required a SQL 6.5 DB, he realises now it was a mistake on his part and would like to revert to SQL 6.5 again and recover his data, is this possible or has he lost all his old data?

BTW Backups weren't completed....

If anyone can help please let me know.

View 1 Replies View Related

Reverse Engineering And Output

Nov 18, 1999

Two Question

1. Is there a stored procedure, or a way to reverse engineer a database? I have a lot of legacy dbs that I have inherited that I need to create a recovery system for. Part of this is creating the scripts to build all of the tables and I would like to automate it.

2. How can I output the results of a stored procedure to a text file? When I run sp_configure I would like that information to go to a text file.

Thanks in advance
Ken Earley

View 3 Replies View Related

DDL Cube Reverse Generate

Aug 9, 2005

Hi guys

I have built several cubes. However I would need to create local cubes from the built cubes in Analysis Services. As a result I need to work out the DDL for my existing cubes. However the cube contains many mdx calculated members. I was wondering if it would be easier to simply generate the DDL from my existing cube in Analysis Services.

Does anyone know any third party tools that I can use to reverse engineer the DDL from the built cubes in Analysis Services ?

Thanks
Tom

View 2 Replies View Related

Reverse-engineer Database

Aug 31, 1998

I`d like to find a script that will create a "create" script for an entire database. It would write a create-table script for every table in the database, complete with all the PKs and FKs too.

Since I`m asking for the world (or at least the world`s creation script), then I`d also like the script to (optionally) write insert statements for all the rows currently residing in all the tables.

Do you have such a script? If not, can you give me a couple of pointers to assist me in writing my own?

TIA

View 3 Replies View Related

Search String In Reverse

Jul 12, 2002

I need to search a string starting at the end to find the
last space in the string, so I can determine the position of the last word in
the string.
Any ideas on how to do this are greatly appreciated.
Kellie

View 3 Replies View Related

Reverse Engineer Script

Aug 3, 2001

does anybody know of a script which can reverse engineer a database to a flat file - aprt from the one which is in enterprise maanger. I want to schedule a job to run once a week to compare the DDL of the database to make sure there are no changes ?

many thnanks

View 1 Replies View Related

[Fwd: Reverse Pattern Matching]

Jul 23, 2005

View 2 Replies View Related

INDEX Possible For Reverse Wildcards?

Jul 20, 2005

If I use _reverse_ wildcard search will it always result in a tablescan? Is it possible to get the DB (Oracle or SQL server) to useindexes when doing reverse wildcard match?let's say I have:table email_address (id int, email varchar)with the following entries2, www.%shoes.%3, w%.super%shoes.%4, %webbox.somecopany.comselect id from email_address where 'www.superdupershoes.com' likeemail;this returns 2,3But the query always results in a table scan even if I add an index toemail. What kind of index can I employ in this situation?Please note that this is a _reverse_ search, the opposite of what'snormally done, i.e. select from email_address where email like'www.%shoes.com'.Thanks!- Robert

View 9 Replies View Related

Reverse Merge Repliction

Mar 1, 2007

hi

I have notice that i missed few columns in my merge repliction and i wonder is it possiblie to reverse a replicated database or copy to normal SQL database?

after that i would do a new Publication.

I need to have the data that is in the Database.

View 1 Replies View Related

Reverse Sign For Display

Aug 13, 2007

In Crystal Reports, there was a "reverse sign for display" property that could be checked for a number box. This was used for debits and credits (and such) so a negative number would be displayed as a positive and a positive displayed as a negative.

How would this work, or is there something simple, in Reporting Services?

Thanks for the information.

View 5 Replies View Related

Inner Join On Reverse Records

Jun 8, 2006

I have some data that looks like this

Col1 Col2 SumCol

XXX,YYY, 5

XXX,ZZZ,6

ZZZ,XXX,7

YYY,XXX,2

I want to do a inner join on that data so I get this

XXX,YYY, 7

XXX,ZZZ,13

Right now I'm using a CTE set to do that, is there a better way??

View 6 Replies View Related

What Is The Query That Would Reverse Data In A Column?

Apr 26, 2002

i keep thinking that this can be done with a query, but so far, none of my queries have worked out:


I have data in a column that I would like to permanently reverse, while not disturbing the rest of the columns. For example:

Col1 col2
--- ----
apple John
pear Amy
beans Sam
carrot Bugs

to be
col1 col2
-- ---
carrot John
beans Amy
pear Sam
apple Bugs

Thanks,
Judith

View 1 Replies View Related

'Reverse' Search Query For Chat Bot

Oct 8, 2005

I am writing a chat bot for IRC in C#. I am using an Access database (for portability etc) - I have a table called tblResponse, it contains a column called Trigger this contains trigger strings, such as:

% wassup%!%

These contain wildcards etc so that they will match different things spoken in the channel, so the above should match:

hey wassup!!
whoah, a bot ... wassup!!

etc. Because this is comparing general conversations, I am doing sort of a reverse search, in that it is not what I am passing in that I am using as the search string, it is what is in the column of the database that serves as the search string. I don't want to have to store the chat text in a temp table and loop through the Response table, calling sql queries for every entry - but all the queries I have tried do not work as intended.

I have tried switching the select query variables like this (this is called from c#, so for here i have just inserted a test value):

SELECT *
FROM tblResponse
WHERE Trigger like 'hey wassup!!!';

This returns nothing, so does:

SELECT *
FROM tblResponse
WHERE 'hey wassup!!!' like Trigger;

Is there anyway I can perform such a search within a sql query that can be processed by MS Access? To recap (in case I have done a poor job explaining this)... I need to use the database entries as the search criteria, if that criteria matches the incoming text string (using the wildcards in the database entries), then return that row - the exact opposite of a convensional 'search' query.


Thanks in advance!!!!

- invid

View 7 Replies View Related

Returning First Entries In Reverse Order

Feb 26, 2007

Hi,
I need to get first entries orderd by datetime asc, but I need the newest of this block returned first.
Imagine to have some entries:

08:00 ...
09:00 ...
10:00 ...
.... ...
15:00
16:00
17:00
....
I want to get the first 3 but the highest in time first.
Like this:
10:00 ...
09:00 ...
08.00 ...

Any idea?
Thanks a lot
Francesco

DaitarnGe

View 19 Replies View Related

Script To Reverse Engineering Schema

Feb 21, 2006

Hi,I'd like to reverse engineer the schema definitions in the SQL Serveron a daily basis and store them in a version control system.Could anyone please let know if there are any tools to reverse engineerthe entire schema definitions in the SQL server. I'd like somethinglike the perl script 'dbschema.pl' for the Sybase ASE.Regards,Dellit.

View 3 Replies View Related

Reverse Parsing Stored Procedure

Jul 12, 2006

Hi All,

I wanted to make a .NET wrapper class that parses a database for a given stored procedure, and finds the name and type of each of it's parameters.

to do so, i need to do the following:

normally, you have a stored procedure and you know its parameters and their types (i.e. int, varchar, etc), based on that, you hard code a call for this storedprocedure on your backend code.

I want to make a wrapper class that goes and finds out what the parameters for an existing stored procedure are, and based on them, create a GUI that allows people to fill them. after people fill this Form out, and click submit, i generate the proper procedure call.

this would basically allow me to create a single class that i can just call to create a form for any given storedprocedure...



thanks
Cheers!

View 4 Replies View Related

Analysis :: Recursive First Reverse Sign Value DAX

Jun 29, 2015

I have a SSAS 2012 Tabular Cube and I am now stuck with a problem concerning something recursive in DAX.Basically I am looking for number of zones jump, provided the sign of the numbers are reverse.E.g. in the figure below. Number of zones jump for the figure -47,067 is 1, since there is a positive value in zone 2. If the Figure in Zone2 had been 0 or a negative number and Zone 3 had the same (i.e. 0 or a negative number) and Zone 4 had a positive number, the number of Zones jump would be 3. Is this something that could be done in DAX? 

View 3 Replies View Related

Parent Child Subtotals / Reverse

Apr 4, 2008

Hi

I'm working with parent-child hierarchies. My source is AS2005. What I have now is:
+ parent 1
child 1.1
child 1.2
child 1.3
+ parent 2
child 2.1
child 2.2

What I would like is:
child 1.1
child 1.2
child 1.3
+ parent 1
child 2.1
child 2.2
+ parent 2

This would allow me to simulate subtotals for the hierarchy in a more financially intuitive way. I call it a simulutation because the optimal solution would be to use a normal group for the parent-child hierarchy and then apply group-headers and -footers. However, this does not seem possible and the documentation I've found also describes parent-child hierarchies wrt. the details-group only.

I have thought sorting the data - perhaps on levels, but I haven't got anything to work yet. One of the things that annoys me the most when developing in RS2005 is that it's very hard to debug the layout. For instance, when I apply sorting - first ascending then descending - and the result is the same I get no messages telling me what's wrong (which there obviously must be...).


Best regards Mikkel

View 5 Replies View Related

Transact SQL :: Remove Reverse Duplicates From Table

Sep 1, 2015

I have table with columns as ID, DupeID1, DupeID2. ID column is unique. DupeID1 and DupeID2 -- the combination should only be there once. I don't want reverse combination of duplicates, i.e. DupeID2, DupeID1 in the table. How can I delete the reverse duplicates from this table?

View 10 Replies View Related

Reverse GroupBy Kind Of Flat File...

Nov 16, 2007

Hi!

I have a data (txt) file which has the following structure


M_ID1:
CID11,Date11
CID12,Date12

M_ID2:
CID,Date21
CID,Date22


My problem now is it, to get that into a table (MID,CID,DATE) as the text file "groups" CID and DATE by MID and
I have no idea how to read the file and transform it.

Well, perhaps somebody out there has an idea!

Thanks in advance!
alx

View 4 Replies View Related







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