many to many tables linked to grid view
- by yousof
i have web page that save data for stores, these stores have activities i want to determine the activities for those stores. this reason i make three tables:
first one is :
tbOLActivity has fields: ActivityId
int (pk), ActivityName nvarchar(50)
second one is :
tbOLStore has fields: StoreId int (pk),
StoreName nvarchar(50), ActivityId int
(fk), Address navrchar(50)
therd one is:
tbOLStoreActivty has fields : SerialNo
int (pk), StoreId int (fk), ActivityId
int (fk), Activity_Status int
i make combobox in web page called "AcivityCombo" to display the data of tbOLActivity table
If CtvAct.GetRecords("Fill_ActivityTb") = True Then
AcivityCombo.DataSource = CtvAct.MainDataset.Tables("tbOLActivity").DefaultView
AcivityCombo.DataTextField = "ActivityName"
AcivityCombo.DataValueField = "ActivityId"
AcivityCombo.DataBind()
the problem is how to select item from this combo and insert it into gridview then save data into the tables