473,802 Members | 1,937 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 11595

"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
1550
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
6903
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
1830
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
8331
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
10851
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
2865
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
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10538
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
10305
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...
0
10063
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
9115
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
7598
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
5494
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
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.