Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / May 2008

Tip: Looking for answers? Try searching our database.

updating datasource using 3-tier architecture

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Raghav - 25 May 2008 04:06 GMT
Hi,

I am retrieveing the data from 2 table (MAster Detail) to the winform
and displaying on winform in a grid view.User should have an uption to
update the rows.So There is a button Update wen ever a person clicks
that DataSource needs to be updated.What i did is in Winforms for
displaying the data i have a dataset.So wenever user clicks the update
button here is what i am doing:

BindingContext[dsAdmin, "MasterMovie"].EndCurrentEdit();
           BindingContext[dsAdmin, "Show"].EndCurrentEdit();
           Adminshow as1 = new Adminshow();
           dsAdmin2 = as1.updateData(dsAdmin);

I am passing the whole dataset to dataaccess layer.

In Data Access Layer:
  public DataSet UpdateData(DataSet ds2)

       {
       SqlCommand cmd1 = new SqlCommand("INSERT INTO [Show]
([TheatreID], [MovieID], [Date], [NumberOfShows], [ShowTimes])" +
                " VALUES (@TheatreID, @MovieID, @Date,
@NumberOfShows, @ShowTimes)", conn);

       dashow1 = new SqlDataAdapter(cmd1);

       SqlCommandBuilder cmb = new SqlCommandBuilder(dashow1);
       DataSet ds7 = new DataSet();
           ds7=ds2;

       dashow1.Update(ds7, "Show");

       ds7.AcceptChanges();
       return ds7;
       }

In BusinessLogic Layer i am just capturing this and passing it to
Winform.

But wen i close the WinForm  and relod the table data again..Its still
showing the old Data not the updated one?I am not getting any error
also..

Please let me know how to go about this...

Thanks,
Raghav
Cor Ligthert[MVP] - 25 May 2008 10:56 GMT
Raghav,

I hope you don't sent the whole dataset to the dataAccess layer but only its
reference by value.
(What you are in fact doing, however a lot to much code which I don't
understand why that is)

Normally is the dataset that you use in your UI and in the DataLayer the
same one.
(In both it is just a reference that points to an object on the managed
heap)

Cor

> Hi,
>
[quoted text clipped - 44 lines]
> Thanks,
> Raghav

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.