473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ObjectDataSource Question

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
FROM DistributionList
WHERE ListName = ?
AND Broker = ?
If however I attempt to execute:

SELECT Account
FROM DistributionList
WHERE ListName = ?
AND Broker = ?
AND Account Not In (SELECT Account
FROM DistributionList
WHERE ListName = ?
AND Broker = ? )

I get an error message that values were not supplied for one or more
variables. Anybody have any suggestions please?
Sep 20 '06 #1
2 1151
?'s are a bad way of doing parameters, you will now need to pass 4 parameters
the two you are probably passing currently and then those two again for the
sub query.
If this is SQL or Oracle, you should use named paremeters and it makes
everything easier to read.

Ciaran O'Donnell
"Frank" wrote:
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
FROM DistributionList
WHERE ListName = ?
AND Broker = ?
If however I attempt to execute:

SELECT Account
FROM DistributionList
WHERE ListName = ?
AND Broker = ?
AND Account Not In (SELECT Account
FROM DistributionList
WHERE ListName = ?
AND Broker = ? )

I get an error message that values were not supplied for one or more
variables. Anybody have any suggestions please?
Sep 21 '06 #2
Hey Ciaran,

Thanks for your reply. I agree that using '?' as parameters is not the best
idea, but with the ObjectDataSource in VS.NET 2005, sometimes when I try to
use:

SELECT Account

FROM DistributionList

WHERE ListName=@ListName

AND Broker=@Broker

the response from the ObjectDataSource designer is that it cannot generate
the statements because of an error near '@'. Kind of a wierd thing, it
doesn't happen all the time, but right now, it won't let me use:

SELECT Account

FROM DistributionList

WHERE ListName = @ListName

AND Broker = @Broker

AND Account Not In (SELECT Account

FROM DistributionList

WHERE ListName = @ListName

AND Broker = @Broker )

I guess I could create a custom datalayer user control and bind to it, but I
was hoping for an explaination of what is happening with the
ObjectDataSource



"Ciaran O''Donnell" <Ci************@discussions.microsoft.comwrote in
message news:4B**********************************@microsof t.com...
?'s are a bad way of doing parameters, you will now need to pass 4
parameters
the two you are probably passing currently and then those two again for
the
sub query.
If this is SQL or Oracle, you should use named paremeters and it makes
everything easier to read.

Ciaran O'Donnell
"Frank" wrote:
>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
FROM DistributionList
WHERE ListName = ?
AND Broker = ?
If however I attempt to execute:

SELECT Account
FROM DistributionList
WHERE ListName = ?
AND Broker = ?
AND Account Not In (SELECT Account
FROM DistributionList
WHERE ListName = ?
AND Broker = ? )

I get an error message that values were not supplied for one or more
variables. Anybody have any suggestions please?

Sep 21 '06 #3

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

Similar topics

1
by: Kristof Van Praet | last post by:
Hello all, The ObjectDataSource control uses reflection to create instances of business components and call the appropriate methods to select, update,... data. How can I use the...
5
by: Ole M | last post by:
I'm having some trouble using the ObjectDataSource in ASP.NET 2.0. I have a wrapper that contains the static methods for Select and Update. The Update-method takes the business object as...
3
by: avezina | last post by:
We would like to use those new cool features of Asp.Net 2.0 like the ObjectDataSource in our project. I tried few basics examples and its work well. Let's say I have a page that displays a...
2
by: planetthoughtful | last post by:
Hi All, I have an ASP.NET page that displays a GridView control based on an ObjectDataSource control. I'm wondering if it's possible to base the ObjectDataSource in question on a parameter...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
3
by: Doug Salomon | last post by:
Hi, Recently, my site has been generating errors which say: "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled...
1
by: Barry L. Camp | last post by:
Hi all, Wondering if someone can help with a nagging problem I am having using a GridView and an ObjectDataSource. I have a simple situation where I am trying to delete a row from a table, but...
1
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...
0
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to...
0
by: fig000 | last post by:
Hi, I'm using an objectdatasource. The insert procedure called by the objectdatasource is in a separate library file outside of the aspx and the codebehind that is using the objectdatasource in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.