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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 29
  • Last Modified:

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

0
fadiel ras
Asked:
fadiel ras
  • 3
1 Solution
 
Pawan KumarDatabase ExpertCommented:
Try..

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

Data Type in Database should be - DATETIME
0
 
fadiel rasAuthor Commented:
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
 
fadiel rasAuthor Commented:
thanks everyone. This solved my issue

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

Open in new window

0
 
fadiel rasAuthor Commented:
I found my problem
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now