473,811 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to implement a variable lenght objectdatasourc e bound to a detailsview

shnaqawi
2 New Member
Dear Friends,

I have an objectdatasourc e which is bound to a details view. the no. of columns are variable. I could do the select function by defining a dynamic sqlSelectComman d. The problem now is that how can I have an update function for myobjectdatasou rce? I tried a function with variable arguments within an array but after that the objectdatasourc e asked for defining the parameter for the array. I don't know how to implement the update function in c#. Is there any other way to implement it?

Thanks,
-Hassan
Feb 12 '09 #1
2 1679
Frinavale
9,735 Recognized Expert Moderator Expert
You need to write multiple update functions.
Each update function will accept the number of parameters (with the same names as the columns) required to update the columns.

If your data source has 5 columns and you want to update all 5, then you need to write an update function that accepts 5 parameters that have the same names as your columns.

Now say your data source only has 3 columns the next time, you need to also provide an update function that accepts 3 that match the names of the columns being submitted.

The update functions will all have the same name, they will just be over loaded, each accepting a different number of parameters.

-Frinny
Feb 12 '09 #2
shnaqawi
2 New Member
Thanks for your reply.
The Numbers and Names of the columns are variable. and I have no idea that what would they be?
I'm designing an online e-training management system. the administrator would be able to add different courses along with adding a variable no. of modules for each of them. now when she associate a new trainee with a course she should also be able to add the scores of each module to the score table for that trainee. Now the problem is that I don't know what are the future courses and modules. That's why I'm looking for a solution by defining a variable length argument for the Update function.
Or maybe I should change the design totally?

-Hassan
Feb 15 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
8708
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press update after making changes, but I don't want that update button. How can I get the updated object when the user presses one of my other action buttons?
2
1583
by: Ram | last post by:
I have an issue with detailsview control bound to an objectdatasource. scenario is i have a business logic component with CRUD methods that accept custom business entity objects. In asp.net layer I'm using gridview and detailsview controls that gets bound to an objectdatasource control which uses my businesslogic CRUD methods. Now If i use all databound fields, all my selects, inserts, updates, deletes work just fine. As soon as i convert...
3
2430
by: CWWong | last post by:
I am using DetailsView using ObjectDataSource with DataSourceTypeName assigned to the specific class. SelectMethod, UpdateMethod and DeleteMethod is working successfully, except InsertMethod. The error msg returned is: Cannot insert the employee. With tracing trigger on, I had discovered that the parameter is actually empty. The data entered is not pass into the parameter at all !!! What could be the possible reason?
1
5563
by: ThomasNexoe | last post by:
Hi there, I quite new to posting in this forum. I have a problem which I truly hope someone can help me out. I have a master/detail page - with a gridview displaying company names, and a DetailsView displaying the selected company from dridview. I'm able to use the DetailsView to insert and update members of the site (companies), but I have this problem with a FileUpload, which is bound to a
2
3826
by: Damon | last post by:
Help! Need this fixed ASAP. I have a GridView/DetailsView master/details form set up, with both bound to separate ObjectDataSource objects. Both the GridView and the DetailsView have a DataKeyNames parameter of "UserCompany, BillableCompany". The DetailsView has control parameters for its select method pointing to these two keys on the GridView. But the select method function receives two copies of the UserCompany field! The...
1
1329
by: J055 | last post by:
Hi I have a Business class called User which returns a DataRow for individual user accounts using accountID as a parameter (i.e. User.Retrieve(accountID)). The ObjectDataSource doesn't complain if I attach the method to the SelectMethod property but the DetailsView does not display it properly. The returned data in the DataRow is correct. Do I need to put the DataRow back in a DataTable first or is there another way? Also, if my class...
2
1174
by: Frank | last post by:
Hello All, I am coding with VS.NET 2005 and attempting to execute a somewhat complicated sql query. I have created a DataLayer and an objectDataSource, bound to a DetailsView; This work no problem if I configure the datasource of the DeatilsView to execute 'SELECT Account
1
1707
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I really hope this is not a case of "this silly thing will never work".....lots of time invested in troubleshooting this already. I have created a standard ASP.NET web form (.aspx) with several collections of textboxes prompting for entry into a fairly monolithic database. I decided to create a business object (called Employee) and use the ObjectDataSource to broker data being transmitted between the UI and my Employee object (and...
0
1581
by: Cirene | last post by:
Using Visual Studio I created a DataSet using the GUI (XSD file). Trying to use a tiered methodology I called the functions from my BLL. Namespace Zzz.BusinessLogicLayer #Region "DAL Access" Public Class States Public Sub New() End Sub
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10135
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.