473,320 Members | 1,846 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,320 software developers and data experts.

How do I pass a System Date Parameter to a SQLDatasource?

374 Expert 256MB
Hey Guys and Gals,

I'm a little stumped on this one. I'm trying to find out how to pass the System Date from the server to a SQLDatasource control.

I need to know the syntax for passing that either in the aspx page, or the code behind file (aspx.vb)

What I have so far is:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
  3.             ConnectionString="<%$ ConnectionStrings:DailyRazorDatabase %>" 
  4.             SelectCommand="SELECT [EventDate], [EventTitle], [EventStartTime], [EventEndTime], [Description] FROM [EventCalendar] WHERE ([EventDate] BETWEEN @EventDate AND @EventDate+30)">
  5.             <SelectParameters>
  6.                 <asp:ControlParameter ControlID="Calendar1" DbType="DateTime" Name="EventDate" DefaultValue=<Need Syntax Here  />
  7.             </SelectParameters>
  8.         </asp:SqlDataSource>
  9.  
  10.  
Thanks for all your help in advance.

Joe P.
Nov 1 '08 #1
1 3069
PianoMan64
374 Expert 256MB
Hey Guys and Gals,

I was able to figure it out with some more research.

What you have to do is create a control on a form. Make it invisiable, and set the value of the control to the current date/time.

Then you can use that control to pass the value in as a parameter.

Thanks again for all your help.

Joe P.
Nov 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Wayne Wengert | last post by:
Using VSNET2005. I want to insert some rows into a table. Each row has 2 columns, "memberid" which is a GUID and "Interests" which is a varchar. I created a SQLDataSource with the values to insert...
3
by: Jim Andersen | last post by:
Just to let you know, and to help any future sorry sods who gets trapped in the same black hole...... You can't just copy/move a working sql-statement into a stored procedure. Working with a...
4
by: Phillip Vong | last post by:
I'm a newbie using VS2005 to learn and test. I'm testing against the Northwind DB. I created a simple variable called "myVariable" and I assigned it the character "c". I want my SQL query to use...
2
by: phil | last post by:
Hi, I want to put a recordset in a gridview but i don't know how to pass the value of the variable in the 'where' statement. The value of the variable is set in the code-behind. i added a tag...
0
by: Managed Code | last post by:
Hello, I have a status and definition table. The status table's current status field relates the ID field of the definition table. I am trying to retrieve the definitions that are associated...
1
by: rosie2006 | last post by:
Environment: .net2.0 over oracle Problem? a simple select statement within a DetailsView that gets two parameter values from a GridView SelectedValue. It might be valuable to understand that to...
3
by: Phillip Vong | last post by:
I'm new and trying to learn. This is in VB.NET 2. I have a simple page with one Textbox1, one Label1 and one Button1. The on_click Button one goes and get's a simple data from the SQL db with...
1
by: John Bailo | last post by:
This is a my solution to getting an Output parameter from a SqlDataSource. I have seen a few scant articles but none of them take it all the way to a solution. Hopefully this will help some...
0
by: HomerS007 | last post by:
Hi, I'm using asp.net 2.0 and sql server 2000 for my first ever project. On one of the page in the application, I want to limit what the user can see based on his/her login. It's a page that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.