我试图找出一种方法来做到这一点:
If (blah = 0 then 'Yes' else if blah = 1 then 'no' else 'maybe')
在mysql中。我正在尝试这样做,因为我通过以下方式将所有数据插入到 gridview 中:
Dim strSQL As String
strSQL = "SELECT id, billing_first_name, billing_last_name, billing_email, billing_address, billing_city, billing_state, billing_zip, " & _
"total, price_mode, process_status, 1 as num_of_items " & _
"FROM orders " & _
"ORDER BY created_on DESC, processed_on DESC LIMIT 0, 20;"
Dim dtReader As MySqlDataReader
objCmd = New MySqlCommand(strSQL, objConn)
dtReader = objCmd.ExecuteReader()
grdView.DataSource = dtReader
grdView.DataBind()
如果我可以在上面的 vb.net 代码中的某个地方而不是在数据库中执行 if/then/else,那也很好。我更习惯于使用普通查询代码这样做。
我目前只能使用 if 和 then else 来执行此操作,而不是 if、elseif 和 then else。
SELECT IF(process_status = 1, 'SUCCEEDED', 'blah') as message, id,...
谢谢!