473,587 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need to create link between DataSet tables to show matching records

My program has to tables in it. One is the Accounts table with all
personal information and then there is also my Memos table with all the
notes for each account. My program displays one record at a time for
each account in the dataset table. I now want to show only the notes
in the memo file that match with the Accounts table current Account #.
I have done some similar to this in Access with a subform linked by
account # to account # and it worked great, just need the same ability
in this application.

Nov 22 '06 #1
6 1871
How does your program show the data? Is it in a grid?

You could do a master/detail grid where the top shows the
Accounts and the bottom shows the Notes that go with the
currently-selected Account. Is that what you're aiming for?
Or are you just trying to get the memo information out
of the DataSet?

Robin S.
--------------------------------
"mike11d11" <mi*******@yaho o.comwrote in message
news:11******** *************@h 48g2000cwc.goog legroups.com...
My program has to tables in it. One is the Accounts table with all
personal information and then there is also my Memos table with all the
notes for each account. My program displays one record at a time for
each account in the dataset table. I now want to show only the notes
in the memo file that match with the Accounts table current Account #.
I have done some similar to this in Access with a subform linked by
account # to account # and it worked great, just need the same ability
in this application.

Nov 22 '06 #2
Right now I have my Account Detail table showing each field on my form
in individual text boxes. I would probably be good to have the notes
part show up in some sort of DataGrid at the bottom, so they can add
additional notes to that record. Any ideas on how I can do this would
be great?

Nov 22 '06 #3
Yes and I only want the notes for the current account showing up in the
Memos Grid at the bottom. And it has to have the functionality of
adding additional notes for the current account.

Nov 22 '06 #4
Is the data for the account bound? So you have a bunch
of textboxes and that info is bound, and then you can
show a grid down below for the notes?

Are you using SQLServer as your data source?

Robin S.
--------------------------------
"mike11d11" <mi*******@yaho o.comwrote in message
news:11******** **************@ h54g2000cwb.goo glegroups.com.. .
Yes and I only want the notes for the current account showing up in the
Memos Grid at the bottom. And it has to have the functionality of
adding additional notes for the current account.

Nov 22 '06 #5
Yes data in the text boxes are bound to the WorkList table. My data
source is SQL 2000 server.

Nov 22 '06 #6
Okay, generally, you have one dataset with both of the
tables in it. Then you need to set up a binding source,
and set the data member and data source
of your controls accordingly. Here's an example.

I don't know how you are creating your dataset. I am
going to assume you created it with the DataSetDesigner ?
Or are you creating it on your own? If you're creating
it on your own, that's a different ball of wax, because
you have to handle the relations on your own.

I have a dataset that has two tables: Customers and Orders.
(This runs against Northwind, so if you have that
installed, you can try this out.)

I set up a strongly-typed dataset using the Data Set
Designer with both of those tables in it, and there is
a field called CustomerID in the Orders table that links
to the CustomerID table in Customers. So Orders have a
Customer as a parent. The data relation between
the customer and the orders is defined as FK_Orders_Custo mers.

This is in Form_Load:

'First, populate the dataset.
Dim nwData As CustomersDataSe t = CustomersDataSe t.GetCustomers( )

'Set the data source for the binding source to the dataset.
CustomersBindin gSource.DataSou rce = nwData
'Add this so it knows which table to use .
CustomersBindin gSource.DataMem ber = "Customers"
'Set the data source for the grid to the customers binding source.
CustomersDataGr idView.DataSour ce = CustomersBindin gSource

'Add the binding for the child; set its binding source to the same
' one as the parent.
Customers_Order sBindingSource. DataSource = CustomersBindin gSource
'Set the datamember to the foreign key joining the two tables.
' You can see this on your CustomersDataSe t diagram.
Customers_Order sBindingSource. DataMember = "FK_Orders_Cust omers"
'Set the data source on the child grid to points at its binding source.
OrdersDataGridV iew.DataSource = Customers_Order sBindingSource

AddTextBoxDataB indings()
AddComboBoxData Bindings()

Here are the routines that bind the textboxes and combo box
in case you want them.

Private Sub AddTextBoxDataB indings()
'Bind each text box to the appropriate field in the
' CustomersBindin gSource
CustomerIDTextB ox.DataBindings .Add("Text", _
CustomersBindin gSource, "CustomerID ")
ContactNameText Box.DataBinding s.Add("Text", _
CustomersBindin gSource, "ContactNam e")
CompanyNameText Box.DataBinding s.Add("Text", _
CustomersBindin gSource, "CompanyNam e")
ContactPhoneTex tBox.DataBindin gs.Add("Text", _
CustomersBindin gSource, "Phone")
End Sub

Private Sub AddComboBoxData Bindings()
ContactsComboBo x.DataSource = CustomersBindin gSource
ContactsComboBo x.DisplayMember = "ContactNam e"
ContactsComboBo x.ValueMember = "CustomerID "
End Sub

Hope that provides enough info. This information
came out of Brian Noyes's book on Data Binding.

If you want to do updates, let them change the data in the
grid, then call the Update method on your table adapter:

CustomersTableA dapter.Update(d s)

I think that should work. Good luck.

Robin S.
-------------
"mike11d11" <mi*******@yaho o.comwrote in message
news:11******** **************@ f16g2000cwb.goo glegroups.com.. .
Yes data in the text boxes are bound to the WorkList table. My data
source is SQL 2000 server.

Nov 22 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2389
by: jason | last post by:
Access 2000: I have a customer-inventory table I need to loop through and compile a list of all the inventory items the customer is tracking. The problem I am finding is that a simple loop will pull out the customer details each time their is an inventory item listed....I need to get the customer out ONCE and list his items....is there an...
5
1719
by: yvan | last post by:
Approximately once a month, a client of ours sends us a bunch of comma-delimited text files which I have to clean up and then import into their MS SQL database. All last week, I was using a Cold Fusion script to upload the cleaned up files and then import the records they contained into the database, though obviously, the process took...
3
3161
by: ChadDiesel | last post by:
Hello everyone. I need some advice on table structure for a new project I've been given. One of our customers sends us an Excel spreadsheet each week containing their order. Currently, someone formats the spreadsheet, prints it out, and manually picks out the products we need to ship. I want to import this into an Access table. ...
2
8565
by: Jacob | last post by:
A simple question: I've read a couple of things that indicates I can create a new table in my database using some SQL command. Is this correct? I would like to load a database into a DataSet, make changes to the existing DataTable(s), add NEW DataTable(s) if necessary and save the changes back to the database. I'm stuck on this problem. ...
0
1174
by: Luis E Valencia | last post by:
Read from above to top. I didnt understand. This is the code that fills that datagrid Public Sub pasar(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
7
1675
by: Ladysniper | last post by:
DESPERATE doesn't begin to describe it. Can someone PLEASE tell me what is WRONG with this code? Now..a bit of background. It is a search results page for http://www.azsoma.info/directory.htm. (use Scottsdale for the city) If you go look, you see that the search results post (I do have my table borders up for debugging) but it doesn't...
4
7881
by: Joris De Groote | last post by:
Hi, (my code is @ the bottom of this message) I have a piece of code that runs the rows of a dataset until it finds the one needed. When he finds it, I delete that row and start all over again with the next row I'm looking for, however. I then get this error: System.Data.DeletedRowInaccessibleException: Deleted row information cannot be...
9
1601
by: Tony Girgenti | last post by:
Hello I developed and tested a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form. I tried doing this without any help, but i'm getting nowhere. I want to create an XML schema (XSD) for a dataset/datatable using the XML designer.
0
1422
by: Ohad Weiss | last post by:
Hi all, I've once asked about that topic. but didn't get an answer. I have a dataset based on 4 tables, which have relation between them. The main table presented to the user on textboxes placed on the form, and the rest of the tables presented on textboxes placed on tabpages (tabpage for each table). Here is the code I use:
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
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...
0
6626
agi2029
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...
1
5718
isladogs
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...
0
3844
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...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.