Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Calendar Date Parameter to SP

Posted on 2006-05-10
4
Medium Priority
?
220 Views
Last Modified: 2008-03-10
What am I doing wrong?

objcmd.Parameters.Add("@SelectedDate", SqlDbType.DateTime).Value = DateTime.Parse(String.Format("{0}/{1}/{2}", ("seldate")))


<tr align=center><td>
<form runat=server>      
<asp:Calendar id="seldate" runat="server" OnSelectionChanged="prntl">
</asp:Calendar></form>            
</td></tr>
                        
0
Comment
Question by:net_susan
  • 2
4 Comments
 
LVL 11

Assisted Solution

by:TornadoV
TornadoV earned 400 total points
ID: 16652478
String.Format("{0}/{1}/{2}"  <- this is the problem.

try objcmd.Parameters.Add("@SelectedDate", SqlDbType.DateTime).Value = DateTime.Parse(String.Format("{0}", ("seldate"))), and it will work fine.

What datetime format are you trying to have?

0
 
LVL 7

Accepted Solution

by:
osiris247 earned 1600 total points
ID: 16653058
If you are passing a value from a calendar is there a reason you converting parse'ing from string to datetime?

try....
objcmd.parameters.AddWithValue("@SelectedDate", seldate.SelectedDate)

Steve
0
 
LVL 1

Author Comment

by:net_susan
ID: 16653467
I think this worked:

 objcmd.Parameters.Add("@SelectedDate", SqlDbType.DateTime).Value=(seldate.SelectedDate)
0
 
LVL 1

Author Comment

by:net_susan
ID: 16653537
Yes, it worked. Thank you!
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question