0

Hi,

I have a aspx page which has no problem to show multiple records from a db table as selected items in list box control ASP.net 2.0. After user change their selection in list box, how can I effectively and correctly post the user selections back to db table?

Is DELETE current records and INSERT new records a better solution? How can I roll back transaction correctly if something wrong happen when executing the sql commands?

Please give your suggestion.

Thanks in advance.

wsee

2
Contributors
3
Replies
5
Views
8 Years
Discussion Span
Last Post by reach_yousuf
0

You should use dataset features

like RowState.added, modified , deleted or unchanged

to know the status of each dataset's datatable row

Mohammed Yousuf uddin

0

Hi Mohammed,

Would you give me example of using rowstate? This is new to me.

Thanks,

wsee

0

Hi there

Apolozise for the delay. U might have fixed ur soltion by this time. but this one for the reference for and other new-bees.

dim pJobsProfile as new JobsProfileDS 'dataset


For Each drwJobsProfile In pJobsProfile.JobProfileInfo
                    dsJobsProfile = New JobsProfileDS
                    Select Case drwJobsProfile.RowState
                        Case DataRowState.Added
                            drwJobsProfile.CreatedBy = objStates.UserName
                            dsJobsProfile.JobProfileInfo.ImportRow(drwJobsProfile)
                            InsertData(dsJobsProfile, objTrans)
                            dsJobsProfile.Clear()
                        Case DataRowState.Modified
                            dsJobsProfile.JobProfileInfo.ImportRow(drwJobsProfile)
                            UpdateData(dsJobsProfile, objTrans)
                            dsJobsProfile.Clear()
                        Case DataRowState.Deleted
                            dsJobsProfile.JobProfileInfo.ImportRow(drwJobsProfile)
                            DeleteData(dsJobsProfile, objTrans)
                            dsJobsProfile.Clear()
                    End Select

Mohammed Yousuf uddin
Software Developer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.