Solved

How do I pass a Date value from a Calendar column using a Stored Procedure

Posted on 2016-10-24
4
22 Views
Last Modified: 2016-10-29
I have a DateTimePicker as a calendar column inside a datagrid.
testing the parameter with "Today.Date" then the record commits.
When trying to use the date time Picker, it fails.
my question is "How do I pass a parameter to a Stored Procedure using a DateTimePicker from a calendar column (The calendar colum is obviously inside a datagridview)

This is my current test code to pass the SP to the SQL table:

AddParamater("@EffectiveDate", Today.Date, DbType.Date)

Open in new window

0
Comment
Question by:fadiel ras
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 28

Expert Comment

by:Pawan Kumar
ID: 41858058
Try..

AddParamater("@EffectiveDate", DateTime.Now , DbType.DateTime)

Data Type in Database should be - DATETIME
0
 

Author Comment

by:fadiel ras
ID: 41858064
Thanks Pawan, this works to also pass today's date. I need to pass the selected date from the DateTimePicker.
I tested it. so when I select a date, the value in the table defaults to today's date, which is my exact problem.
thanks, please try to assist further, thanks
0
 

Accepted Solution

by:
fadiel ras earned 0 total points
ID: 41858072
thanks everyone. This solved my issue

AddParamater("@EffectiveDate", (dr.Cells("EffectiveDate").Value), DbType.String)

Open in new window

0
 

Author Closing Comment

by:fadiel ras
ID: 41865079
I found my problem
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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