Hi,
I try to setup relationship (one-to-many) between two tables as in the code:
Sub App_Start
Form1.Show
dbpath="C:\Documents and Settings\user\Desktop"
con.New1
cmd.New1("",con.Value)
con.Open("data source =" & dbpath & "\SQL_Rel")
cmd.CommandText="create table if not exists Auther (AuthID integer,name string, primary key ('AuthID'))"
cmd.ExecuteNonQuery
cmd.CommandText="create table if not exists Books (AuthID integer,Books string, foreign key ('AuthID') references Auther ('AuthID') on delete cascade)"
cmd.ExecuteNonQuery
End Sub
On deletion of record in the author table it is supposed to delete the related record(s) in the Books table automatically. I manually inserted one record in both tables and when deleted from Author table the corresponding (?) record(s) is not deleted from the Books table. I’m sure some thing wrong is there. Please correct me.
Best regards,
I try to setup relationship (one-to-many) between two tables as in the code:
Sub App_Start
Form1.Show
dbpath="C:\Documents and Settings\user\Desktop"
con.New1
cmd.New1("",con.Value)
con.Open("data source =" & dbpath & "\SQL_Rel")
cmd.CommandText="create table if not exists Auther (AuthID integer,name string, primary key ('AuthID'))"
cmd.ExecuteNonQuery
cmd.CommandText="create table if not exists Books (AuthID integer,Books string, foreign key ('AuthID') references Auther ('AuthID') on delete cascade)"
cmd.ExecuteNonQuery
End Sub
On deletion of record in the author table it is supposed to delete the related record(s) in the Books table automatically. I manually inserted one record in both tables and when deleted from Author table the corresponding (?) record(s) is not deleted from the Books table. I’m sure some thing wrong is there. Please correct me.
Best regards,