Custom Parameter for Select Paramters - How to use the value of another field as the paramter default.

SELECT     ArticleID, ArticleTitle, ArticleDate, Published, PublishDate, PublishEndDate
FROM         UserArticles
WHERE     (ArticleDate >= PublishDate) AND (ArticleDate <= PublishEndDate)

When I use the above on a GridView I get nothing.  Using SQL manager it works great.

I don't know how to pass the value of the ArticleDate field as a default parameter or I think that's what I don't know how to do.

I am trying to create a app that I can set the dates an article will appear on a page and then go away depending on the date.

 Thanks for any help!

 

0
sayitfast
3/5/2008 9:43:47 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
144 Views

Similar Articles

[PageSpeed] 0

Please review your databinding code. Since you haven't used a parametrized query and the Sql Query Analyser gives you the result, there might be a problem in your databinding code. Have you called the Bind() method on the GridView at the correct place like in the Page_Load() event.

-------------------------------------------------------------------------------------------------------------------------------

Please click Mark As Answer if this helped in solving your problem.


Please click "Mark As Answer" if this hepled in solving your problem.
0
sudipta
3/6/2008 10:42:04 AM
Reply:

Similar Artilces:

Use a result field from one datasource as a select parameter in another
I have a details view which returns all of a clients details based a contract number sent to a stored procedure. I want to use the returned clientID from that query as a query parameter in separate stored procedure to display all of the sites associated with that client. Does anyone know how I can achieve this? On this page I want to use the information for when a user edits the sites field in the contractsDetail view, so it returns all of the sites in checkboxes; but on another page I wish to do this when the page loads.Also, can I make it so that when the user clicks update for the contrac...

Adding a default value to sql select parameters in vb.net
Hi,     I know it's easy to select the default value if you use the sql data source object to configure your query and feed it the select parameters. However, i will like to know if it's possible or what's is the syntax to add a default value to sql query being executed before page is post back. Below is what i have so far: the text strikethrought is the missing piece i need help making it the default value.Dim connect As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("Solution_DA_LiveConnectionString").ToString()) Dim sqlcom...

Selecting value in one field then causes value in another field to be selected.
I have a web form which contains a date field, the date is populated using a DatePicker which is Javascript based. The form also has a drop down box containing 3 values. What I want to do is when a date has been selected that this will cause the dropdown list value to change to dated which is one of its 3 values. i.e. when the date field is not blank then the value will be selected in the dropdown. What I also want to happen is when the date has been selected and the dropdown value is dated then the date field and the dropdown field will be set to read only.Anyone any ideas how to this usin...

How to select a field value from a selected row from a DataGrid in order to use it as a parameter
I am working on a web application, and I have two DataGrids.  Then end-User is supposed to select a row from one of the grids, and the event should select a key from that row in order to use it as a parameter to fill the other DataGrid.  I have been trying to do so, but I dont work the same way as I used to do it in windows applications.   I would appreciate any suggestions,   Thanks. Is there some code we can look at? I've done similar things and I've never had any problem with them. In the first grid have a select column, when it is clicked you can catch the Sel...

Can I use a Formula Field or Report Parameter in my SQL Command when using a Command as my datasource?
Instead of having the database tables as my datasource, I'm creating a command (double clicking the Add Command Node under my server connection in the database expert) and using that for the fields on my report. I need to be able to use a formula field (or even a report parameter) in that command SQL so that I can pass dates that will change at runtime to my SELECT statement. Is that possible? Yeah it is possible but you have to preset the filters in your report and then pass the information (i.e. dates) as parameters. To learn how to do this there is an article on www.aspalliance.com/...

How to use GridView row's Key selected for Delete as select parameter for another datasource
I'm not sure if the subject title makes sense, but it wasn't too easy to describe what I'm trying to do in one sentence! When a user clicks on the delete link in a GridView row, I want to run a stored proc, using the Key of the selected record as the parameter for the stored proc. I then want to programatically access the result of the stored proc (it'll be an integer value) for code-behind use. I wrote out a few steps to help me figure out what I need to do: 1) Get the value of PersonnelID (the DataKey) from the selected row in the GridView2) Set that Perso...

linking a sql field to point to the value of another sql field
is it possible to create hyperlinks in powerbuilder such that if you retrieve two fields from a database.. and want to display the first field on the screen and have it link to the value of the other field (when clicked) which is actually a URL address, you can? any help will be appreciated. thank you! ...

How to pass parameter value from one sql datasource to another?
Hi everybody, Here is the problem, how to pass the values from one datasource to another one on the same aspx page, without coding?  I have a page with FormView control to present data for one selected record from a search page, with edit item and insert item templates created. The main sql datasource keeps control on everything with select, update, delete and insert methods. For insert I am using existing stored procedure, for which the wizard generated all the required parameters. In Command and Parameter Editor I can see them, and I need to define all of th...

Me again, sqldatasource/control paramters and using code as a default value
Hi , i'm trying to do somethign like this- <asp:Parameter Type="String" DefaultValue="Request.UserHostAddress.Tostring()" Name="IP" /> But alas, the "Request.UserHostAddress.Tostring()" is being treated as a string before its being executed (if that makes sense).... But if i remove the "   "  's   i get a compiler error, any ideas? i've tried stuff like adding '   in places, but its not helping.... if also tried withouth te type anmd loads of other goodies, but still not working. Any help is appreaciated, its probably something reeally simpl...

Using a Session field as default field value
Hi all, I am brand new to ASP.NET, this is my first post here. I have build a form, with a Formview control, set to Insert item. That page will be used to add record to a database. I have a field called "Listing_Owner" which will store the Authentified user name. I know how to get the User name, but I just don't know how to set the Username as default value for that owner field, which will be hidden. I tried to write code in the Page_Load event, but it does not seems to find my field. Any idea? I hope it is clear, this is all new terms for me. Thanks alot.  New to ASP... loo...

Converting a gridView using an Sql Datasource to a gridview who is not using an SQL DataSource
How can i rewrite this page so that i doesnt make use of an SqlDataSource?  <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginHistory.ascx.cs" Inherits="Private_UserControls_WebUserControl" %> <html> <head> <%--<link rel="stylesheet" href="BaldwinPortal.css" mce_href="BaldwinPortal.css" type="text/css" />--%> <title>Login History</title> </head> <body style="margin:0 0 0 0;padding:0 0 0 0"> ...

Using selected values from a Multi Select Listbox in a SQL query
I have seen a few post concerning this but don't really understand fully as I am new to this.  I would appreciate any help 1) First I loop through the Listbox control and get the selected values: Dim li As ListItemFor Each li In lbPClass.Items If li.Selected = True Then strPC += li.Value & ", " End If Next Label5.Text = strPC The resulting string looks something like: 101, 102, 100 ,    I get rid of the last space and "," with the following statement Label6.Text = Left(Label5.Text, Trim(Len(Label5.Text) - 2)) 2) I would then like to ...

How to change the SQL used for the GridView, when using a control parameter in the datasource
I'm using a GridVeiw with and Access database. I want to allow users to select a date and then update the GridView to show only data entered after that date. So my question is, how do I modify the SQL used by the datagrid? I'm using a control parameter as part of my AccessDataSource and I think that is what I'm having trouble figuring out how to include. Here is my datasource, with the control parameter in the the GridView. The GridView works fine with these initial settings settings. <asp:AccessDataSource ID="AccessDataSourceForwView" runat="server" ConflictDetection="Compa...

Is it possible to use a variable(computed field) as a parameter to another computed field
--____TAYPSSOPSIQFPCQHOOXS____ Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable I am using pb 7 , datawindow painter, a computed column I am trying to get column data from different rows in grouped data from a = datawindow. The easiest way to get the data was to just put the column = name and the row needed ..ie run_seconds[-10] . This works fine except I = need to get different rows based on rowcount for that group. What that = means is that for one group I would need row 3,10 and 20. For the next = group I would need rows 12, 15, 50 and ...

Web resources about - Custom Parameter for Select Paramters - How to use the value of another field as the paramter default. - asp.net.sql-datasource

Parameter - Wikipedia, the free encyclopedia
A parameter (from the Ancient Greek παρά , "para", meaning "beside, subsidiary" and μέτρον , "metron", meaning "measure"), in its common meaning, ...

fb_source Parameter - Facebook-Entwickler
This document lists the complete list of values for the fb_source parameter that is returned with th...

Google Webmaster Tools Parameter Handling - Flickr - Photo Sharing!
You aren't signed in Sign In Help Home The Tour Sign Up Explore Explore Home Last 7 Days Interesting Popular Tags Calendar Most Recent Uploads ...

Cat 8: TIA performance standards committee chairman previews parameters of forthcoming twisted-pair cable ...
Category 8, the next-generation twisted-pair cabling specification, is still in development, but the outlook looks quite positive that it will ...

Philippine president asks for 'parameters' of Mayon Volcano tours
Philippine president asks for 'parameters' of Mayon Volcano tours People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, Apr, May, ...

Alternatives to boolean parameters
... ) { PrintLine ( item . Name ); if ( printDetails ) { PrintLine ( item . Description ); } } } Aha! Now can see that the boolean parameter ...

Exporting Error (Error in Parameter...: Apple Support Communities
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability ...

Apple tech monitors device aging, adjusts operating parameters to ensure optimal performance
... describing a method of monitoring the aging of a device's electronics, comparing the data with a global average and modifying operating parameters ...

Is it poor programming practice to pass parameters as objects?
... a free, community-powered network of 100+ Q&A sites . Risser asked: So, we've got a guy who likes to write methods that take Objects as parameters, ...

Parameter Short Film Competition sponsored by Grolsch
Grolsch presents Parameter The A.V. Club Short Film Competition Please Enter Your Date of Birth Ineligible entry Enter For people over the age ...

Resources last updated: 11/25/2015 10:33:58 PM