小编Fug*_*tor的帖子

针对YTD,MTD,WTD总计的SQL查询

我希望这个查询能够自动地知道今天的日期和时间以及一年(或一个月)(或一周)的第一天......

SELECT TicketID
FROM   Ticket
WHERE     (Ticket.DtCheckOut > '1/1/2011 12:00:00 AM') 
      AND (Ticket.DtCheckOut < '8/27/2011 12:00:00 AM')
Run Code Online (Sandbox Code Playgroud)

我知道它会GETDATE()以某种形式使用,但你不想看到我想出的东西,我保证!

这是我在MDSN上阅读的GETDATE() 内容:GETDATE(Transact-SQL)

我环顾四周和谷歌 - 并没有找到任何'干净' - 所以任何输入都会很棒!

sql sql-server select date sql-server-2008-r2

6
推荐指数
1
解决办法
1万
查看次数

选择中的MySQL程序?

我有一个这样的程序:

mysql> call Ticket_FiscalTotals(100307);
+---------+--------+----------+------------+------------+
| Service | Items  | SalesTax | eTaxAmount | GrandTotal |
+---------+--------+----------+------------+------------+
| 75.00   | 325.00 | 25.19    | 8.00       | 433.19     |
+---------+--------+----------+------------+------------+
1 row in set (0.08 sec)
Run Code Online (Sandbox Code Playgroud)

我想在select中调用这个过程,如下所示:

SELECT     Ticket.TicketID as `Ticket`, 
Ticket.DtCheckOut as `Checkout Date / Time`,
CONCAT(Customer.FirstName, ' ', Customer.LastName) as `Full Name`, 
Customer.PrimaryPhone as `Phone`,

(CALL Ticket_FiscalTotals(Ticket.TicketID)).Service as `Service`

FROM Ticket
INNER JOIN Customer ON Ticket.CustomerID = Customer.CustomerID 
ORDER BY Ticket.SiteHomeLocation, Ticket.TicketID
Run Code Online (Sandbox Code Playgroud)

但是我知道这是非常错误的.有人可以指点我正确的方向吗?我需要在最终的Select中访问程序中的所有列(加入?).该过程中的SQL代码相当痛苦,因此首先是它的原因!

mysql sql stored-procedures user-defined-functions

6
推荐指数
2
解决办法
2万
查看次数

DataGridView ComboBox EditingControlShowing事件

我有一个基本的WinForms应用程序与d DataGridView(名为dgvHardware)控件,绑定到此控件是这段代码:

    private void dgvHardware_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
    {
        if (e.Control is ComboBox)
        {
            ((ComboBox)e.Control).SelectionChangeCommitted -= new EventHandler(cboDgvHardware_SelectionChanged);
            ((ComboBox)e.Control).SelectionChangeCommitted += new EventHandler(cboDgvHardware_SelectionChanged);
        }
    }

    private void cboDgvHardware_SelectionChanged(object sender, EventArgs e)
    {
        // string result is the selected text of the combo box
        // int row is the row index that the selected combo box lives
        string result = ((ComboBox)sender).SelectedItem.ToString();
        // int row = ????
    }
Run Code Online (Sandbox Code Playgroud)

简而言之,我需要能够确定事件被触发的行,以便根据ComboBox选择更改行中的其他单元格.第二个函数的结果返回正确的值,这是值得的.

如果不清楚或者您是否需要任何其他信息,请告诉我.

谢谢,
安德鲁

c# datagridview datagridviewcombobox winforms

3
推荐指数
1
解决办法
1万
查看次数