I have a gridview object with a sqldatasource as its sourceid.
Everything was going so well until I came across this problem.
My SELECTCOMMAND for my sqldatasource is:
select alertid,subject ,createdt,event id,eventname, statuscd,trgid from
vwAlerts order by createdt desc
Now, based on a fiew input fields, I put together a WHERE clause for
the filterexpressio n. For example, this filterexpressio n works great:
createdt >= '1/1/2007' and createdt <= '1/31/2007'
Simple so far. I also have an input field which is actually a field
in a child table (emaildistribut ion). If they put anything in this
field, the filterexpressio n needs to do an IN clause like this:
createdt >= '1/1/2007' and createdt <= '1/31/2007' AND alertid
IN(select alertid from emaildistributi on where emailaddress like
'%yahoo.com%'
When I run this, I get an "Missing operand after 'alertid' operator"
error. Doesn't matter if I use LIKE or = in the IN clause. Is there
any way to make this work? I hate to go back to the manual binding
method.
Thanks for any help!
--Curt 3 5176
Hi
Can you post yor aspx page code?
Regards
"Curt" <ad***********@ sshomes.netwrot e in message
news:11******** **************@ j27g2000cwj.goo glegroups.com.. .
>I have a gridview object with a sqldatasource as its sourceid.
Everything was going so well until I came across this problem.
My SELECTCOMMAND for my sqldatasource is:
select alertid,subject ,createdt,event id,eventname, statuscd,trgid from
vwAlerts order by createdt desc
Now, based on a fiew input fields, I put together a WHERE clause for
the filterexpressio n. For example, this filterexpressio n works great:
createdt >= '1/1/2007' and createdt <= '1/31/2007'
Simple so far. I also have an input field which is actually a field
in a child table (emaildistribut ion). If they put anything in this
field, the filterexpressio n needs to do an IN clause like this:
createdt >= '1/1/2007' and createdt <= '1/31/2007' AND alertid
IN(select alertid from emaildistributi on where emailaddress like
'%yahoo.com%'
When I run this, I get an "Missing operand after 'alertid' operator"
error. Doesn't matter if I use LIKE or = in the IN clause. Is there
any way to make this work? I hate to go back to the manual binding
method.
Thanks for any help!
--Curt
Curt,
The FilterExpressio n applies to the dataset after it gets loaded from the
database. It doesn't effect the select statement. Rather the select gets the
data inside the dataset and then the FilterExpressio n hides undesired rows.
Based on this understanding, putting another select in the IN operator
should not work since the select is intended to run against the database,
not against the dataset.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
"Curt" <ad***********@ sshomes.netwrot e in message
news:11******** **************@ j27g2000cwj.goo glegroups.com.. .
>I have a gridview object with a sqldatasource as its sourceid.
Everything was going so well until I came across this problem.
My SELECTCOMMAND for my sqldatasource is:
select alertid,subject ,createdt,event id,eventname, statuscd,trgid from
vwAlerts order by createdt desc
Now, based on a fiew input fields, I put together a WHERE clause for
the filterexpressio n. For example, this filterexpressio n works great:
createdt >= '1/1/2007' and createdt <= '1/31/2007'
Simple so far. I also have an input field which is actually a field
in a child table (emaildistribut ion). If they put anything in this
field, the filterexpressio n needs to do an IN clause like this:
createdt >= '1/1/2007' and createdt <= '1/31/2007' AND alertid
IN(select alertid from emaildistributi on where emailaddress like
'%yahoo.com%'
When I run this, I get an "Missing operand after 'alertid' operator"
error. Doesn't matter if I use LIKE or = in the IN clause. Is there
any way to make this work? I hate to go back to the manual binding
method.
Thanks for any help!
--Curt
Thanks for your replies.
I got it to work. Eliyahu your reply got me thinking...I never
considered changing the SELECT command if the user enters any
information in a certain field. Now I just change the select command
to include the IN clause...this works great.
Thanks !
-Curt This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: |
last post by:
Hello,
Does anyone have an idea on how I can filter the data in the gridview
control that was returned by an sql query?
I have a gridview that works fine when I populate it with data. Now I want
to look at that data and filter it based on what is in it.
I know that this could have been done with data sets and data views in
asp.net 1.1 but how is this done now in asp.net 2.0?
|
by: Ken |
last post by:
Hi All -
I have a filtered GridView. This GridView has a check box in the first
column. This check box is used to identify specific rows for delete
operations.
On the button click event I loop through the filtered GridView to identify
the selected rows and assemble some XML to be sent to a stored proc.
The problem I have is that when looping through the GridView, it doesn't
|
by: Bill Manring |
last post by:
I am writing a very simple web application using VS 2005 and a SQL Server
Database. I am just starting to experiment wth .NET 2.0 and I am trying out
the supposedly improved databinding.
I dragged a table from a datasource on to my web form and the GridView
cpntrol was created. I turned on paging, and Edit and Delete buttons. I ran
the app and everything worked great - not a single line of code written yet.
Then I wanted to add a...
|
by: Henry Habermacher [MVP Access] |
last post by:
Environment: VS2005, ASP.Net 2.0, SQLServer 2000, VB.Net, IIS6
I use a GridView Control which is based on a SQLDataSource. The datasource
is based on a Select statement and is filtered by the FilterExpression. The
GridView also has a pager element (below, displaying first, previous, next,
last icons), paging is enabled, page contains 10 rows.
The user now skips some pages by clicking a view times on the next icon.
Now he changes the...
|
by: Andrew Nav |
last post by:
I dragged a table from a datasource on to my web form and the GridView
cpntrol was created. I turned on paging, and Edit and Delete buttons. I
ran the app and everything worked great - not a single line of code written
yet.
Then I wanted to add a simple feature where the user could filter out data
based on a value in a single column. I added a little code that set the
FilterExpression property of the SqlDataSource, and that seemed...
| |
by: P. Yanzick |
last post by:
Hello,
I've been playing with master/detail views as well as editing in the
gridview, and I ran across a strange problem that I am not exactly sure
where to go to try to solve.
I have 2 tables, a table of cars (pretty basic, an ID, a description, and a
Color ID) and a table of colors (Color ID, and a color description). I've
added a gridview and a detailsview as I'm playing with both and how to get
editing features to work the way I...
|
by: DummyDumb |
last post by:
Hi,
I've got a Gridview utilizing a filterexpression:
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
OnDeleted="ItemDeleted"
EnableCaching="true" SqlCacheDependency="APP_TIMESHEET:AB"
CacheKeyDependency="AB"
SelectMethod="GetABs" TypeName="RetrieveABData" DeleteMethod="DeleteAB"
|
by: Bishop |
last post by:
I have a number of simple select queries that a user needs to be able to
execute and display the data on the screen in a gridview. My thought was
that I could use a Gridview set to dymanically generate columns and bound to
a SQLDataSource. Then the user can click buttons (or whatever) and it
changes the SelectCommand property of the SQLDataSource and re-binds the
GridView.
That worked great until I enabled paging. When paging is...
|
by: mike |
last post by:
I have a page with a LoginView which contains a Gridview and a
DetailsView, each in its own UpdatePanel
The problem that I am experiencing is that when I select a record in
the Gridview (using a SelectButton), the selected record is shown in
the DetailsView, which is correct - however, when I choose "Update" on
the DetailsView I am presented with the EditItemTemplate which
contains the first record in the DetailsDataSource.
The code...
|
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,...
|
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...
| |
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...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |