Vb.net命令不起作用但在SQL中工作

时间:2018-01-10 00:26:27

标签: sql vb.net

我在VB.NET中有以下代码:

  Try
        konneksie.Open()
        Dim Query As String
        Query = " Update ontledings " &
                " set SlaagB = CASE WHEN LaasteSuiker >= SuikerParsreels THEN 'JA'  " &
                " WHEN LaasteSuiker < SuikerParsreels And LaasteSuiker > 0 THEN 'NEE'  " &
                " WHEN LAST Is NULL THEN 'GEEN' " &
                " End "

        COMMAND = New SqlCommand(Query, konneksie)
        READER = COMMAND.ExecuteReader
        MessageBox.Show("Toets of aan SUIKER parsreels voltooi in skedulering EN ontledings")
        konneksie.Close()
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    Finally
    End Try
    konneksie.Close()

显示NULL的结果。但是,当我在SQL中运行以下查询时,它可以正常工作:

      Update ontledings 
                 set SlaagB = CASE WHEN LaasteSuiker >= SuikerParsreels THEN 'JA'  
                 WHEN LaasteSuiker < SuikerParsreels And LaasteSuiker > 0 THEN 'NEE' 
                 WHEN LAST Is NULL THEN 'GEEN' 
                 End

我无法弄清楚代码有什么问题。任何帮助将不胜感激。

0 个答案:

没有答案