Solved

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

Posted on 2016-10-24
4
19 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 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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