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 / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

Best way to move data from gridview to Sql table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hartbypass - 14 Aug 2006 19:38 GMT
Hello all.

I am trying to move data from my Gridview, essentially a dataset, to a
Sql table I created.  I am trying to do this without having to create a
stored proc that I have to call every time I interate through a row.
So I am trying to see if this is conceptually possible.

Basically create a DataAdapter that is tied to my SqlServer table.
Fill that DataAdapter with the Dataset that I am using for my Gridview.
I assume I will have to do this my interating through the rows of my
DataSet and "Add" them to the DataAdapter.  Then tun an update on the
DataAdapter and be done with it.

Any thoughts?

Greg
Nicholas Paldino [.NET/C# MVP] - 14 Aug 2006 19:45 GMT
Greg,

   You don't have to do any of this.

   First, you ^should^ be creating a stored procedure to handle the insert,
update and delete operations on your table and then send them to your
SqlDataAdapter (in the form of SqlCommand objects).

   Then, you can just call the Update method on your data adapter and then
it will cycle through the rows, calling the appropriate stored procedure.

   Hope this helps.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hello all.
>
[quoted text clipped - 12 lines]
>
> Greg

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.