如何使用此工具打印预览,打印设置,打印,日期时间选择器 [英] how to use this tools print prieview, print setup, print ,date time picker
问题描述
亲爱的先生,我想打印prieview,从数据网格视图中选择项目,并打印带有我提供的标题和日期的选择的项目,我已经搜索了很多显示此结果的Querry,但它们非常令人困惑,另一件事是我已经使用datetimepicker选择日期,但是当我选择日期并且将日期保存在dd-mm-yyyy hh-mm-ss中时,所以当我在输出usng日期中搜索时,找不到记录,因为bcoz它搜索的日期是我想在表单中使用日期格式,并且只存储dd-mm-yyyy值的字符串格式
我已经在sql中写了日期为{[DATE] [nvarchar](40) NULL,}
的命令,并且在c#中我将日期绑定为
dear sir i want to printprieview ,the selected items from data grid view and also to print the selcted items with title provided by me and date i have searched lots of querry showing this results but they very much confusing ,and another thing is that i have use datetimepicker for selecting date but when i select the date and when date is saved its in dd-mm-yyyy hh-mm-ss so when i searched in output usng date no records are found bcoz it searches date which is in string format i want to use date in my form with only dd-mm-yyyy values stored
i have written commands in sql for date is {[DATE] [nvarchar](40) NULL,}
and in c# i am binding date as
{
dateTimePicker1.DataBindings.Clear();
dateTimePicker1.DataBindings.Add("Text", dv, "DATE");
}
保存按钮上的保存日期
for save date on save button
{
cmd = new SqlCommand("insert into REGISTRY values(@CUSTUMER,@DATE)",con);
cmd.Parameters.Add("@DATE", SqlDbType.NVarChar, 20);
cmd.Parameters["@DATE"].Value = dateTimePicker1.Value;
}
如果您能帮助我,我将是非常棒的,我是软件编程的新手,我将如何解决它.
please it would be very great if you help me i am new to software programing and i am getting how to solve it.
推荐答案
我认为您可以使用它.
I think that you can use this.
cmd.Parameters["@DATE"].Value = String.Format("dd-mm-yyyy",dateTimePicker1.Value);
并了解有关SQL和字符串的更多信息.它将帮助您...
谢谢.
And read more about SQL and Strings. It will help you...
Thanks.
对于Print和PrintPreview,您可以参考此文章...
基本文本和图像打印 [ DataGridView打印/打印预览解决方案-第二部分 [ ^ ]
他们会为您提供帮助.
谢谢.
For Print and PrintPreview you can refer this articles...
Basic Text and Image Printing[^]
And
DataGridView Print/Print Preview Solution - Part II[^]
They will help you.
Thanks.
这篇关于如何使用此工具打印预览,打印设置,打印,日期时间选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!