473,783 Members | 2,577 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

master detail vb.net 1.1

23 New Member
I am using vb.net 1.1

Hi,
I am trying to create a master/detail form with Access

I am creating a master/detail setup with master records in a textbox and the details are in a datagrid. This is departments tables(master) and details table (table1) linked by deptno, Pk and Fk.


i filled the data sets and liked the relation parent to child.

.I can get it ti work with 2 datasets and just load a dataset using sql and 'where' clause from a text box, without using data relation.

on last line here i get
error:Cannot create a child list for field mytable1.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  
  4.     Private Sub LoadDepartments()
  5.  
  6.         Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\andrew visual basic\datagridBindAll\db1.mdb;")
  7.  
  8.         Dim cmd As New OleDbCommand
  9.         Dim cb As OleDbCommandBuilder
  10.          cmd.CommandText = "Select * From Departments"
  11.  
  12.         cmd.Connection = cn
  13.         da.SelectCommand = cmd
  14.  
  15.         cb = New OleDbCommandBuilder(da)
  16.         da.UpdateCommand = cb.GetUpdateCommand
  17.         da.InsertCommand = cb.GetInsertCommand
  18.         da.DeleteCommand = cb.GetDeleteCommand
  19.  
  20.         da.Fill(ds, "Departments")
  21.  
  22.         cmd.CommandText = "Select * From table1"
  23.  
  24.         cmd.Connection = cn
  25.         da.SelectCommand = cmd
  26.  
  27.  
  28.  
  29.         da.Fill(ds, "table1")
  30.  
  31.  
  32.     End Sub
  33.  
  34.     Private Sub BindControls()
  35.         Dim cmd As New OleDbCommand
  36.          Dim relation As DataRelation
  37.  
  38.         DeptBinder = Me.BindingContext(ds, "Departments")
  39.  
  40.  
  41.         relation = _
  42.              New DataRelation("mytable1", _
  43.                  ds.Tables("Departments").Columns("deptno"), _
  44.                 ds.Tables("table1").Columns("deptno"))
  45.  
  46.  
  47.  
  48.         ds.Relations.Add(relation)
  49.  
  50.         txtdeptno.DataBindings.Add("Text", ds, "Departments.DeptNo")
  51.         txtDname.DataBindings.Add("Text", ds, "Departments.DName")
  52.         txtLoc.DataBindings.Add("Text", ds, "Departments.Loc")
  53.  
  54.         DataGrid1.SetDataBinding(ds, "table1.mytable1") 'error Cannot create a child list for field mytable1.
  55.  
  56.  
  57.  
  58.  
  59.  
  60.     End Sub
  61.  
  62.  
  63.  
Sep 25 '07 #1
1 1657
jagguy
23 New Member
I get an error and i use 1 dataset and 1 data adapter. I create the link as a data relation in departments in column 'deptno'.

i filled the data sets and linked the relation .The departments PK's deptno has many table1 FK's deptno.

I get an error with datagrid last line. I just used the MS 6 step instructions with minimal code as an example.

I will have to use my way if this MS way fails to work.
Sep 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1469
by: Marcel | last post by:
Hi, I'm new to VS and ASP.NET and have a question about master/detail datagrids. I have a master datagrid filled with data via a component that contains a SQL adapter. Now I would like to fill a detail datagrid (which will contain a number of detail records) based on the selected master. Is it possible to
2
423
by: ruca | last post by:
Hi, I have a master and a detail datagrid. I put detail grid showing insise of a column of master grid. The problem is that it's not what I really want. What I really want would be that the detail grid appears between rows of master grid, i.e., when I select one record in master grid that detail grid appears between the selected row and next row. I know that the reason why my detail grid is show in one master column it's because I...
2
1998
by: Ken C | last post by:
I've setup a Master detail table from a typed dataset on 2 different data grid The first one I bind it with the Master data table name The second data set I bind it with the MasterDetail Relation name so that I can obtain a "Detail Auto change" effect when current master record is moving around, which is suggested on syncfusion FA http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q780 But the problem is when I try to update a new...
2
1377
by: Coen | last post by:
Hello, I have a strange performance delay of about 2 sec's in moving to the next row. I use multiple forms with each master-detail table relations. The master-table displays it's table rows in databound textboxes, the detail tables in datagrids, and of course relations defined between the master and detail tables. All the tables are part of one dataset (per form). The following happens. When moving to the next tablerow (next record) I...
1
2183
by: Sam | last post by:
Attached I am sending 2 URL's from MSFT ASP.net Quick Start Tutorial Web Site. 1) Run it URL: http://www.asp.net/QuickStart/aspnet/samples/data/GridViewMasterDetai... 2) View Source URL: http://www.asp.net/QuickStart/util/srcview.aspx?path=~/aspnet/samples...
0
1302
by: Sam | last post by:
Sorry to post the same post multiple times but the URL Addresses were not Correct in Earlier Posts. Here are the correct URL's: 1) Run It URL is here: http://www.asp.net/QuickStart/aspnet/samples/data/GridViewMasterDetailsInsertPage_vb.aspx
1
1531
by: Gary200 | last post by:
Hello All, I bind two datagrids in a master-detail relationship successfully. What I want is to set allowNew and allowDelete disabled in both datagrid using dataview. The code like this: Dim masterGrid As DataGrid Dim detailGrid As DataGrid
7
4539
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent records. Should I design a new form for this or can I somehow make this work in the same form. Thanks in advance, john
0
1727
by: Mike Wilson | last post by:
Dear group, I have an invoice entry form, which is a simple Master fields / Detail grid. The main summary information of the invoice are stored in one table in a dataset, which is bound using a BindingSource (InvoiceBindingSource). The line details of each item in the invoice is held in a child table which is bound to another bindingsource (InvoiceRowsBindingSource). I took the basic design from an MSDN article, and all works well....
2
2288
by: John | last post by:
Hi I am trying to create a master/detail form. I have my master and details tables dragged onto the dataset. I have also dragged the fields from master table on the form which has created the navigation toolbar for me and which works fine with the master table. I also have a dataview on the same form ready for detail table but as yet not assigned to the detail table. How can I now create a master/detail relationship between my master and...
0
9643
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10083
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
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...

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.