我試圖想出一個辦法做到這一點:的MySQL如果別人對asp.net的GridView
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()
如果我能做到的if/then /在vb.net代碼上面,而不是在數據庫中的其他地方,那麼這將是也很好。我更習慣於用普通的查詢代碼這樣做。
我目前可以只用if和else來做這個,而不是if,elseif然後else。
SELECT IF(process_status = 1, 'SUCCEEDED', 'blah') as message, id,...
謝謝!
這樣做了,lcarus!謝謝! – StealthRT 2012-08-13 19:34:34