Link to home
Start Free TrialLog in
Avatar of fadiel ras
fadiel ras

asked on

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

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

Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Try..

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

Data Type in Database should be - DATETIME
Avatar of fadiel ras
fadiel ras

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of fadiel ras
fadiel ras

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found my problem