尝试通过检查条件使用单个插入语句插入不同的结果集
我有一个带有四个文本框、两个下拉列表和一个“保存”按钮
文本框的 winform,就像这些
Startdate 文本框,其中在文本框中输入了值 2011-03-02 (yyyy-mm-dd)
在文本框中输入值的结束日期文本框 2013-09-04 (yyyy-mm-dd)
截止日期文本框,在该文本框中输入的值为 (2011-03-15) (15 2011 年 3 月)
到期金额文本框,在该文本框中输入的值为 120.00。
付款选项下拉列表,值为 12 个月现金、24 个月 现金
付费选项下拉列表,包含每年、每月的值
我有一个表格,
paymentschedule
columns: paymentscheduleid
datetobepaid
amountdue
paymentoption
,当您单击“保存”按钮时,
这些值将保存在如下表中,设置这将是结果集,如果“付费选项”是每月,结果集如下(付费选项是每月)
paymentscheduleid datetobepaid amountdue paymentoption
1 2011-04-15 120.00 12 months cash
2 2011-05-15 120.00 12 months cash
3 2011-06-15 120.00 12 months cash
4 2011-07-15 120.00 12 months cash
- - - -
- - - -
- - - -
20 2013-08-15 120.00 12 months cash
如果付费选项是每年,那么结果集将是这样的(付费选项是每年)
paymentscheduleid datetobepaid amountdue paymentoption
1 2011-04-15 120.00 12 month cash
2 2012-04-15 120.00 12 months cash
3 2013-04-15 120.00 12 months cash
datetobpaid 取决于开始日期和到期中输入的值日文本框
是否可以使用 mysql 和 c# 使用单个 insertstatement
任何人都可以帮助解决这个问题
,非常感谢......
i have a winform with four textboxes and two dropdown lists and a Save button
textboxes are like these
Startdate textbox with value entered in the textbox 2011-03-02
(yyyy-mm-dd)Enddate textbox with value entered in textbox 2013-09-04 (yyyy-mm-dd)
due day text box, value entered in that textbox is (2011-03-15) (15
th of march 2011)amonut due textbox with value entered in that textbox is 120.00.
paymentoption dropdownlist with values 12 months cash, 24 months
cashpaid option dropdownlist with values yearly , monthly
and i have a table
paymentschedule
columns: paymentscheduleid
datetobepaid
amountdue
paymentoption
when you click on save button the values are saved in table like below set
this will be the resultset if "paid option" is monthly and the result set is given below (paid option is monthly)
paymentscheduleid datetobepaid amountdue paymentoption
1 2011-04-15 120.00 12 months cash
2 2011-05-15 120.00 12 months cash
3 2011-06-15 120.00 12 months cash
4 2011-07-15 120.00 12 months cash
- - - -
- - - -
- - - -
20 2013-08-15 120.00 12 months cash
if paid option is yearly then the result set will be like this (paid option is yearly)
paymentscheduleid datetobepaid amountdue paymentoption
1 2011-04-15 120.00 12 month cash
2 2012-04-15 120.00 12 months cash
3 2013-04-15 120.00 12 months cash
the datetobpaid depends on startdate and the value entered in the due day textbox
is it possible to use single insertstatement using mysql and c#
would any one help on this problem
many thanks......
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是在 MS Sql 上完美运行的,您可以根据需要将其更改为 Mysql:
这里 Paidoption 和其他字段是静态设置的。尽管您可以将其用作输入参数
希望这可以解决您的问题
This is perfectly run on MS Sql you can change it to Mysql as you need:
here Paidoption and other fields are set statically .Although you can use it as input parameters
Hope This May Solve your problem