Updating multiple tables in database using one Gridview control

I have a SQL datasource which performs a join on multiple tables which is displayed through a gridview. I would like to be able to edit the columns but can't figure out how to do an update on multiple tables at once. 


"
        SelectCommand="SELECT aspnet_Users.UserName, aspnet_Membership.Email, aspnet_Roles.RoleName, aspnet_Membership.IsApproved FROM aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId INNER JOIN aspnet_UsersInRoles ON aspnet_Membership.UserId = aspnet_UsersInRoles.UserId INNER JOIN aspnet_Roles ON aspnet_UsersInRoles.RoleId = aspnet_Roles.RoleId">
0
joseph
5/29/2007 2:37:16 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

4 Replies
3946 Views

Similar Articles

[PageSpeed] 53
Get it on Google Play
Get it on Apple App Store

Your best bet would be to write a stored procedure for updating the tables, and have the UPDATECOMMAND of your gridview call that proc... 


Andrew S. Erwin
Software Developer
ReflectSystems, Inc.

0
cyberwin
5/29/2007 3:29:31 PM
I'm relatively new to stored procs mixed with grid views; How would I fix the error "procedure contains too many arguments"? Do I have to explicitly return the values?
0
joseph
5/29/2007 6:08:35 PM

joseph.nowak:
I'm relatively new to stored procs mixed with grid views;

Please have below walkthrough on Displaying Data Using a Stored Procedure in the GridView Web Server Control :

http://msdn2.microsoft.com/en-us/library/k10148y1(VS.80).aspx

joseph.nowak:
How would I fix the error "procedure contains too many arguments"? Do I have to explicitly return the values?


This usually means what it says, that your update, delete or insert command is trying to pass more parameters than the stored procedure is set up to handle. This can happen because each datakeyname specified in the gridview control is automatically being sent to the stored procedure. So if you try to also define extra parameters, you will be passing too many. Also, using the refresh parameters button within the datasource wizard will create a parameter for a return value even if your stored procedure does not define one, so if your stored procedure does not have a return value you should remove this parameter.

Here is an article on how to troubleshoot 'Procedure or function has too many arguments specified' in asp.net 2.0:

http://www.whitworth.org/Blog/PermaLink,guid,ee69ddf8-3096-4818-abdb-0542d2fc191e.aspx


NOTE:If you find my response contains a reference to a third party World Wide Web site, I am providing this information as a convenience to you.Microsoft does not control these sites and has not tested any software or information found on these sites; therefore,Microsoft cannot make any representations regarding the quality,safety, or suitability of any software or information found there.
__________________________________________________

Sincerely,
Young Fang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
0
Young
6/4/2007 6:43:20 AM
Thanks for the reply and article links. Very helpful!
0
joseph
6/4/2007 1:19:26 PM
Reply:

Similar Artilces:

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

How do I update from two DetailsView controls using thebuilt-in Update button of one control?
I have two DetailsView Controls.  I want to update my database with the values in both the first and second DetailsView controls when I click the Update button on the first control.  Actually, I want to do the same thing with the Insert(Add) button. Any suggestions would be greatly appreciated.  ...

Issue with getting values from child controls in a gridview, to use for the update using a SQLDataSource control
Hi all, I have a gridview bound with a SQLDataSource. I am using the Update feature of the SQLDataSource to update a SQL Server database with values entered into the gridview. However I am not getting it to work. I believe this is due to the controls that contain the user entries are not the gridview itself, but rather child controls within the gridview. I have been using the names of the actual controls but nothing happens. Upon submit, the screen returns blank, and the database is not updated. Here is some code:   <asp:GridView ID="GridEditSettlement" runat="server" AutoGenerate...

How can I use multiple DataKeyNames with one GridView and multiple DetailsView controls, all on the same page?
I've been struggling with this all day, and just spent 3 hours searching through forums but can't find an answer... I have 1 GridView control and 2 DetailsView controls, on the same page, and all are bound to my Access database. GridView1 contains TeamID and StatusID DetailsView1 correctly displays TeamID and TeamMemberName when a record is selected in GridView1. DetailsView2 should display StatusID and StatusDescription when a record is selected in GridView1, but it won't.  It appears to be picking up TeamID instead. I read something about trying: GridView.DataKeys(Index1...

Updating a database using a DetailsView control with a dropdown list control
Hi everyone,I have a templated field on a DetailsView control that displays an integer ID value taken from a database table. The item template uses a label control to display the ID number. The edit Item template uses a dropdown list to display the string names associated with each ID. The data source for the DDL comes from a separate table. The text field for the DDL is set to the string name and the value field is set to the integer ID. When the user selects a different name from the DDL in edit mode and clicks the Update button the label control becomes blank and the original valu...

Updating Multiple Database Tables From One Gridview
So I have an aspx page that uses a grid view to display a table called "NAMES" on the page. There is a second table called "NAMES2" that shares a foreing key with "NAMES" that is displayed on a different aspx page.  I am able to update to both tables from the same grid view. Example.  If I update let say my "TOTAL" column for "JOHN" on the table "NAMES" through my gridview on aspx page(1) and go to another page aspx page(2) that displays the table "NAMES2", "JOHN";s total will be updated no ...

using controlS to control a gridview
This question is probably posted but i did not bother to look at 10,000+ posts so i am sorry. I've seen the tutorial where he builds a dataset and uses a gridview and controls the gridview with the drop down list box. What i am trying to do is to control the gridview with 2 drop down list boxes. First select the Country you life in and then the State. I've looked at the grid view properties but couldn't find where i can add another parameter. Is it possible to control a grid view (or any form of displaying the information) with more than 1 controller? Thank You.  ...

How to add the data present in the controls to a table control without any database involvement.
Hi All,i am four controls where i will write the text and once i click the add button those should get added to the table .i want 6 columns fixed in the table and rows as many as required.i tried doing that taking a table server control and able to load the table.but the problem is whenver i am adding a new row the old one is gfetting overwritten by this and at the end i am getting only one row.  System.Web.UI.WebControls.Table t1 = new System.Web.UI.WebControls.Table();  i have declared the below one global TableRow tr; TableCell tc1; TableCell tc2; TableCell tc...

Updating a Label control in one user control from another user control
Hi all, I have a main page in my music store site that has 5 user controls on it with 1 always showing main content and the others being things like a shopping cart, "best sellers", genre list etc (a la amazon). From the main content control I want to be able to set some label controls in my shopping basket control but I just can't seem to work out the syntax for how to do this: Here's the code I'm using - I'm trying to go to the 4th user control on the page (my shopping basket) then find the appropraite label, cast it locally as a Label then update the value: Label _so...

Having one update command for multiple gridview and formview controls...
 Hi folks, I am trying to create a webform using the Formview control with some embedded Gridview controls in it.  The form is used for updating existing data in the company database.  What I would like is to have it where users can make updates to the gridviews and the formview textboxes and then click a final update button that will commit all the changes to the database.  What I have right now is gridviews that update independently of the main form.  For example, if you update a row in the gridview, it will use the built in update command to make the changes ...

How do I control one control from another control?
I have a page page1.aspx which is within a master page. On page I have a table with two cells. Within each cell I have placed two controls (ascx) that I have developed. Now I'd like to be able to get these two controls to interact. One needs to update the other. One has some search criteria that the other one needs to update its gridview. One needs to make the other visible/not visible at certain times. Out of the box neither control can see each other at all. Is there a good article or someplace I can find some information on how to do this?  AllAboutFocus.com. Information Technolo...

What control do I use (or do I not use a control at all...)
Okay so here's the story so far. I am making a blog to be incorporated into a website. Well, I'm doing the blog from scratch. I'm using MySQL to source all the data via MySQL .NET/Connector. Now while developing the script, I used DataReader and Response.Write to show the blog topics. Now that it has come to put it under a design (I'm using a Master Page for that), I've hit the problem. Response.Write shows all the topics before any of the design elements could be incorporated. So that (more or less) is out of question. So next I looked into the data presentation controls. I looked up GridVi...

using javascript getting value from textbox when edit button is clicked and both controls are present in gridview control
Hi All using javascript I want to get value  from textbox when edit button is clicked and both controls that is texbox and button are present in gridview control .Alok Hi aloksinha83, Please see this post: http://forums.asp.net/t/1069245.aspx Thanks,Qin Dian TangMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

masterpage and control formatting (table control, HTML table control)
I have a master page that contains 1 contentplaceholder.  In my default.aspx (that uses the masterpage layout) I have a table server control.  During page_load I get the data I need and repeatedly add the usercontrol to the table control, one user control per row.  My user control is basically a HTML table with several rows and columns that's populated with data upon creation. I want this table to fill the contentplaceholder's width. In addition within the masterpage I have a CSS link for my stylesheet. Here are my questions: Is there a better way of adding ...

Web resources about - Updating multiple tables in database using one Gridview control - asp.net.presentation-controls

Wikipedia:Updating information - Wikipedia, the free encyclopedia
This page documents an English Wikipedia editing guideline . It is a generally accepted standard that editors should attempt to follow, though ...

Facebook Updating Software Development Kit For Apple IOS 6 To Reflect Integration
With Facebook integration officially coming to Apple’s iOS 6 mobile operating system for its iPhone and iPad tablet, what new features are in ...

Updating how Cost per Click is Measured on Facebook
To help advertisers better understand how their ads perform, we're updating the definition of cost per click on Facebook. Learn what the change ...

Updating Your App for iOS 9: What You Need to Know
Updating Your App for iOS 9: What You Need to Know

Facebook for iPhone 3.0 to Include Page Updating
... who want to more easily update their Facebook Pages on the go: Facebook for iPhone 3.0 , which should be released soon, will include Page updating, ...

Updating trends on mobile
Trends are a great way to find out what people are talking about on Twitter at a given moment and at a single glance. Starting today, we’re making ...

Delhi Metro Fare Calculator and Auto-Updating Map on the App Store on iTunes
Get Delhi Metro Fare Calculator and Auto-Updating Map on the App Store. See screenshots and ratings, and read customer reviews.

BlackBerry Bold 9000 Updating #2 - Flickr - Photo Sharing!
Explore berrytokyo's photos on Flickr. berrytokyo has uploaded 126 photos to Flickr.

LOOT v0.7.0 for Mod Organizer: Updating and Installation - YouTube
A new version of LOOT (Load Order Optimisation Tool) has been released with some major upgrades. This video tutorial shows how to upgrade and ...

Updating Emma: Jane Austen's classic joins list of literary reworks
Jane Austen published six novels. Just six. She died before she completed the seventh.

Resources last updated: 1/15/2016 8:33:25 AM