473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

master detail vb.net 1.1

23
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 1632
jagguy
23
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
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...
2
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...
2
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...
2
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...
1
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:...
0
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: ...
1
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: ...
7
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...
0
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...
2
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
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...
0
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...
0
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,...

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.