473,789 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting ObjectDataSourc e Parameter Programmaticall y

JJ
How can I set an ObjectDataSourc e's Parameter programmaticall y?

The slight complication here is that I want to set this NOT in the
'Selecting' method of the ObjectDataSourc e, but elsewhere.

I was hoping I could do something like:

ObjectDataSourc e.SelectParamet ers("MyParam") = thisValue.

But clearly not. I've managed to add a parameter with a value, but I cannot
reset it (it just adds another one and adds a number to its name to make it
unique):

ObjectDataSourc e.SelectParamet ers.Add("MyPara m", thisValue) - works for one
itertion, but I need to set it to a new value each time.

I guess I could remove this each time and add the parameter again, but I
would have though there was a way I could change the value?

Thanks in advance,

JJ
May 16 '07 #1
2 11594

"JJ" <ab*@xyz.comwro te in message
news:Ou******** ******@TK2MSFTN GP04.phx.gbl...
How can I set an ObjectDataSourc e's Parameter programmaticall y?

The slight complication here is that I want to set this NOT in the
'Selecting' method of the ObjectDataSourc e, but elsewhere.

I was hoping I could do something like:

ObjectDataSourc e.SelectParamet ers("MyParam") = thisValue.

But clearly not. I've managed to add a parameter with a value, but I
cannot reset it (it just adds another one and adds a number to its name to
make it unique):

ObjectDataSourc e.SelectParamet ers.Add("MyPara m", thisValue) - works for
one itertion, but I need to set it to a new value each time.

I guess I could remove this each time and add the parameter again, but I
would have though there was a way I could change the value?

Thanks in advance,

JJ
Instead of adding each time you can check the count of parameters. If it is
zero (not set) then add the parameter. Otherwise get the current parameter
from the SelectParameter s collection and reset the value of the "MyParam"
parameter.

Lloyd Sheen

May 16 '07 #2
JJ
Ah I see. Thanks,

JJ
"Lloyd Sheen" <a@b.cwrote in message
news:36******** *************** ***********@mic rosoft.com...
>
"JJ" <ab*@xyz.comwro te in message
news:Ou******** ******@TK2MSFTN GP04.phx.gbl...
>How can I set an ObjectDataSourc e's Parameter programmaticall y?

The slight complication here is that I want to set this NOT in the
'Selecting' method of the ObjectDataSourc e, but elsewhere.

I was hoping I could do something like:

ObjectDataSour ce.SelectParame ters("MyParam") = thisValue.

But clearly not. I've managed to add a parameter with a value, but I
cannot reset it (it just adds another one and adds a number to its name
to make it unique):

ObjectDataSour ce.SelectParame ters.Add("MyPar am", thisValue) - works for
one itertion, but I need to set it to a new value each time.

I guess I could remove this each time and add the parameter again, but I
would have though there was a way I could change the value?

Thanks in advance,

JJ

Instead of adding each time you can check the count of parameters. If it
is zero (not set) then add the parameter. Otherwise get the current
parameter from the SelectParameter s collection and reset the value of the
"MyParam" parameter.

Lloyd Sheen

May 16 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2259
by: J Krugman | last post by:
I have a form with a couple of submit buttons, plus a "pseudolink" that is also supposed to submit the form; the submitted form data feeds to a CGI script. The two submit buttons have the name "go_for_it", so that when the form is submitted, the CGI script looks for the value of the CGI parameter "go_for_it". I want the pseudolink to set the value of this CGI parameter prior to submitting the form, but I can't get it to work. Here's the...
2
2726
by: Anil | last post by:
Hello, I am using VS2005 Beta2 and I have added a Simple Line-Graph chart to a ReportViewer control. I can click on the chart and alter for example the Minimum and Maximum scale values of the Y-axis. The question I have is that, can I change these values from within my code and how?
1
1547
by: fripper | last post by:
In VB 2005ave a I have a picture control ("pix") on which I want to set each pixel color according to a variable, X, that has been calculated (I'm drawing fractals from the Mandelbrot Set). I use the statement: pix.SetPixel(i, j, myColor) where i and j are the coordinates of the pixel and myColor is a variable of type Color. Now X has a maximum value that it can attain (call it LimitX) and I want the color of a given pixel to be some...
3
6902
by: Robert | last post by:
What is the best way to pass a parameter to an ObjectDataSource. I am able to add a new parameter to the SelectParameters, but I would like to just assign a value to an existing parmeter at runtime. Currently I am just adding the parameter at runtime and setting the value: ObjectDataSource1.SelectParameters.Add("searchCCN", "") I would like to accomplish the following: ObjectDataSource1.SelectParameters.("LastName") = "Doe"
1
2892
by: tparks69 | last post by:
Can anyone tell me is there an easy way to get a value into an objectdatasource select parameter from Application Variables? Obviously its easy from cookies, session etc... but what about Application? Or is there an easy way to get a value into an objectdatasource parameter from the web.config? Kind of like how we get the connection string from web.config into a datasource object, like: <asp:SqlDataSource ID="SqlDataSource2"...
0
1828
by: Alejo | last post by:
hi. I am currently using "form" authentication ( asp.net's membership and role management) in my app, I wanna use the objectdatasource control to fill data into my gridview but I need give a parameter to get the data. This parameter is the UserId wish is inside the session in my app. I don't know how item select in the "Parameter Source" combo box in the objectdatasource, in order to get the UserId of my session and what write in the...
5
8329
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I have the following AccessDataSource control on my page.. <asp:AccessDataSource ID="adsAllStories" runat="server" DataFile="~/App_Data/Stories.mdb" SelectCommand="SELECT StoryID, StoryTitle FROM Stories WHERE StoryTitle LIKE '?%' ORDER BY StoryID DESC"> <SelectParameters> <asp:Parameter Type="char" DefaultValue="A" Name="AllParam" />
12
10847
by: karanj | last post by:
Hi all, I'm facing an issue with Access that I haven't been able to find a solution for, despite hours of googling, so I hope someone here can help! I've got a report - rptClientsByCountry - which is based on a query - qryClientsByCountry - that takes a parameter, myCountry, to filter the results. I need to be able to generate this report depending on the user's choice of country, preferably from a drop-down list. Leaving aside for a...
0
2864
by: Question123 | last post by:
Hello.. i want to pass 3 parameters for SelectMethod and 1 parameters for SelectCountMethod of ObjectDataSource. How can i pass these?? And how ObjectDataSource can distinguish which parameters for which methods.?? Please help me. --Regards
0
9663
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
10404
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
10193
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
10136
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,...
1
7525
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
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.