I have 3 related tables in a DataSet - Customers, Products and Orders.
I am trying to create an "editable" DataGridView which, ideally, will contain columns from all the tables. I have tried creating the joins in the TableAdapter SQL, but this results in a read-only data grid.
Customers and Orders are joined in a 1:M relationship by CUSTID.
Products and Orders are joined in a 1:M relationship by PRDID.
When the user adds a new Order record they will key the ORDERID, CUSTID, PRDID and QTY. I would like the DataGridView to display the related CUSNAM and PRDDES as soon as the user has keyed the Order record. The data must be displayed on a single data grid row. I am not interested in drill down or multiple data grids. My data looks like this:
Orders: ORDERID, CUSTID, PRDID, QTY
Products: PRDID, PRDDES
Customers: CUSTID, CUSNAM The data grid should look like this:
ORDERID, CUSTID, CUSDES, PRDID, PRDDES, QTY My SQL would look like this:
SELECT Orders.ORDERID, Orders.CUSTID, Customers.CUSNA ME, Orders.PRDID, Products.PRDDES , Orders.QTY
FROM (ORDERS
INNER JOIN CUSTOMERS ON Orders.CUSTID = Customers.CUSTI D)
INNER JOIN PRODUCTS ON Orders.PRDID = Products.PRDID;
Can someone please point me in the right direction? Any advice is much appreciated.
1 9319
With some guidance from DeborahK on MSDN Forums I have managed to configure a TableAdapter to Use SQL joins by following this tutorial: http://www.asp.net/learn/data-access...ial-69-vb.aspx
I had originally tried creating joins in the TableAdapter SQL, but this resulted in a TableAdapter which was not updatable (no insert, update, delete methods). The trick is to use Stored Procedures which is clearly detailed in the tutorial.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: TeleTech1212 |
last post by:
I am trying to select specific columns from multiple tables based on a
common identifier found in each table.
For example, the three tables:
PUBACC_AC
PUBACC_AM
PUBACC_AN
each have a common column:
|
by: Raed Sawalha |
last post by:
I have the following code where Build the relation on DataSet Schema I got
the error that Child Has Multiple Tables
DataTable LoData = new DataTable("LearningOutcomesDT");
DataTable LoDocData = new DataTable("LearningOutcomesDocDT");
da = new SqlDataAdapter(BuildSQLQuery(BookId,queryType.LOBook),oSql);
da.Fill(LoData);
ds.Tables.Add(LoData);
da = new SqlDataAdapter(BuildSQLQuery(BookId,queryType.LODoc),oSql);
|
by: Jason L James |
last post by:
Hi all,
does anyone know if I can create a dataview
from multiple datatables. My dataset is constructed
from four separate tables and then the relationships
are added that link the tables together. To make
data entry easier I would like to combine selected
columns from the four tables onto a single dataview that
could be used as the datasource for a datagrid
control. The distinct updates, insert ans delete
|
by: Paul Cheetham |
last post by:
Hi,
I have a DataGridView control, and I am using it's datasource property
to assign a datatable to it at runtime.
The datatable has some columns in it that I don't want to be visible.
With the DataGrid control in .Net 1, each Column had a property that
allowed it to be bound to a column in a datatable, so I could define the
columns of the grid, and which columns they related to in its
datasource, and they were all that would display.
|
by: NS3687 |
last post by:
In my work, very often I come across the scenario that the service team keep their information per month in seperate tables. Some time, the same month in 2 tables, some time one table per month. As for the table structures, there are some changes as well, for some months new columns will be added etc. In all table, there is a column "ID" that contain unique number for each row.
However, most of my analysis would need data from the columns...
| |
by: dreaken667 |
last post by:
I have a MySQL database containing 16 tables of data. Each table has a different number of columns and there are few common field names accross tables. I do have one master table with which I connect the tables together with various queries using a unique id. My task is to generate reports from these tables dynamically. The user will select the data they want to see and the script will export a spreadsheet containing this data. I've got the...
|
by: anureddy |
last post by:
help me
how to add datagridview columns to another table,using windowsapplications.
and set the displaymember and value member datagridviewcomboboxcolumn.
i used this below code but that not exicute.
how can i write that code.
pls send me code.
|
by: aktar |
last post by:
After rummaging through mysqls website I've decided to ask the community.
Is it possible to show columns from multiple tables, eg:
SHOW COLUMNS FROM table_A, table_B
Furthermore, is it possible to get information for selected columns eg
SHOW column_1, column_4, column_8 FROM table_A
|
by: suganya |
last post by:
Hi
I have a GridView in my Page. I have to bind multiple tables into the GridView using SQLDataSource. For that I have given the coding as
<asp:GridView ID="Search_GridView" runat="server" Style="z-index: 100; left: 2px; position: absolute;
top: 270px" AutoGenerateColumns="False" OnSelectedIndexChanged="Search_GridView_SelectedIndexChanged" CellPadding="20" Width="720px" AllowPaging="True"...
|
by: DeanL |
last post by:
Hi guys,
Does anyone know of a way to create multiple tables using information
stored in one table? I have a table with 4 columns (TableName,
ColumnName, DataType, DataSize) and wanted to know if there is a way
to use the information in this table to create the many tables that
are listed in the source table instead of creating each table
individually?
Many thanks for any help you can offer.
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |