简体   繁体   English

如何将所选日期从AJAX日历控件传递到存储过程

[英]How to pass selected date from AJAX calendar Control into stored procedure

I have written an insert stored procedure in oracle 11g. 我在oracle 11g中编写了一个插入存储过程。 I am able to pass all the values except date value which I am getting from an Ajax calendar control in asp.net page 我可以传递除从asp.net页中的Ajax日历控件获取的日期值以外的所有值

I have textbox with this control, when user select the date from calendar control it will display in that textbox. 我的文本框带有此控件,当用户从日历控件中选择日期时,它将显示在该文本框中。 How to pass the textbox value into the stored procedure? 如何将文本框值传递到存储过程?

Written in C# for asp.net application 用C#编写的ASP.NET应用程序

Some of ways I tried 我尝试过的一些方法

command.Parameters.Add(new OracleParameter("p_WARRANTYENDDATE", OracleDbType.Date));
command.Parameters["p_WARRANTYENDDATE"].Value = Convert.ToDateTime(AMCStartDateTextBox.Text).ToShortDateString();

even tried to pass it as string 甚至试图将其作为字符串传递

 string AD = Convert.ToDateTime(AMCStartDateTextBox.Text).ToShortDateString();
 command.Parameters.Add(new OracleParameter("p_AMCSTARTDATE", OracleDbType.Varchar2));
 command.Parameters["p_AMCSTARTDATE"].Value = AD;

Getting unterminated string constant error 获取未终止的字符串常量错误

I tried this below code & it works !!!!!! 我尝试了下面的代码,它可以正常工作!

string AMCStartDate = Convert.ToDateTime(AMCStartDateTextBox.Text).ToShortDateString();
command.Parameters.Add(new OracleParameter("p_AMCSTARTDATE", OracleDbType.Date));
command.Parameters["p_AMCSTARTDATE"].Value = AMCStartDate;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM