I am working on a project in Visual Studio 2017 using C# which shows and saves test results, although I created a trial solution file to simplify the tables.
I have made a service-based database dtbTrial
and created the following tables:
for tblTestMain
:
CREATE TABLE [dbo].[tblTestMain]
(
[TestNumber] NUMERIC(8) NOT NULL PRIMARY KEY,
[TestDate] DATE NOT NULL,
[AmbientTemp] INT NOT NULL,
[Test1] BIT NOT NULL,
[Test2] BIT NOT NULL,
[Test3] BIT NOT NULL
)
for tblTest1
(also similar with tblTest2
and tblTest3
):
CREATE TABLE [dbo].[tblTest1]
(
[TestNumber] NUMERIC(8) NOT NULL PRIMARY KEY,
[ParameterA] REAL NULL,
[ParameterB] REAL NULL,
CONSTRAINT [FK_tblTest1_tblTestMain] FOREIGN KEY ([TestNumber]) REFERENCES [tblTestMain]([TestNumber])
)
The main table is in Form1
and the three others are in Form2
, Form3
, and Form4
. The main form has a TabControl containing these three forms and functions like my previous question.
Now, what I am trying to do is that the data contained in the three sub forms or child forms navigate together with the parent form such that when Form1
navigates from test number 10000000 to 10000001, the three other forms follow suit when open. I tried using this query to dtbTrialDataSet
:
SELECT tblTestMain.TestNumber, tblTestMain.TestDate, tblTestMain.AmbientTemp, tblTestMain.Test1, tblTestMain.Test2, tblTestMain.Test3, tblTest1.ParameterA, tblTest1.ParameterB, tblTest2.ParameterC, tblTest2.ParameterD,
tblTest3.ParameterE, tblTest3.ParameterF
FROM tblTestMain LEFT OUTER JOIN
tblTest1 ON tblTestMain.TestNumber = tblTest1.TestNumber LEFT OUTER JOIN
tblTest2 ON tblTestMain.TestNumber = tblTest2.TestNumber LEFT OUTER JOIN
tblTest3 ON tblTestMain.TestNumber = tblTest3.TestNumber
and used the resulting dataset to the forms above but to no avail. What did I miss or what should I do to rectify it?
PS I haven't made any related codes to the main form yet since I'm at loss as to which commands I shall be needing.