Solved

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

Posted on 2016-10-24
4
17 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
  • 3
4 Comments
 
LVL 18

Expert Comment

by:Pawan Kumar Khowal
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now