想要从asp.net webapplication将日历控制数据保存到sql server数据库 [英] Want to save calender control data to sql server database from asp.net webapplication
本文介绍了想要从asp.net webapplication将日历控制数据保存到sql server数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好全部。
我是新的在 asp.net中。我正在建立一个网站 我的培训项目其中我有插入 日期 和 保存每当用户时, sql server 数据库选择日期。我希望 知道该日期的数据类型 字段当我在创建表 时 sql server 数据库。
另外,我如何使用日历控件 选择 date 和 将保存到 sqlserver 数据库。
请帮帮我们。我被困在这里。
解决方案
看看这个: -
在您的设计区域中创建日历和文本框。
并执行此cs文件: -
< pre lang =cs> protected void Calendar1_SelectionChanged( object sender,EventArgs e)
{
TextBox1.Text = Convert.ToString(Calendar1.SelectedDate.ToShortDateString());
}
on button_click只需将文本框值保存在sql数据库中
同样在你的sqlserver中,将date_column字段数据类型作为date。
快乐编码;)
你有没有尝试过什么?
拿日历和文本框怎么样,然后ondateselect calender属性设置文本框值= calender.selecteddate。
Lemme知道你是否还有其他问题。
PS:你应该在google上做一些研究。
Hi all.
I am new in asp.net. I am making a website for my training project where i have insert date and save it to sql server database whenever the user selects a date. I want to know what should be the datatype of this date field when i am creating the table in sql server database .
Also how do i use the calender control to select the date and save the selected to the sqlserver database.
Please help me guys. I am stuck here.
解决方案
Check this out:-
Create a calender and textbox in your design area.
And do this cs file:-
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { TextBox1.Text = Convert.ToString(Calendar1.SelectedDate.ToShortDateString()); }
On button_click simply save the textbox value in your sql database
Also in your sqlserver take the date_column field datatype as "date".
Happy coding ;)
Have you tried anything?
What about taking the calender and textbox, Then ondateselect property of calender set the textbox value = calender.selecteddate.
Lemme know if you face any further problem.
PS:You should do some reasearch on google.
这篇关于想要从asp.net webapplication将日历控制数据保存到sql server数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文