我想从 <DllImport("user32.dll")> _
Public Shared Function SetForegroundWindow(hWnd As IntPtr) As Boolean
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click `
AutoSaveTimer.Enabled = True
Try
'Find the handle to the game. This can do it by searching for the process.
Dim p As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("notepad")
'search for process notepad
If p.Length > 0 Then
'check if window was found
'bring notepad to foreground
SetForegroundWindow(p(0).MainWindowHandle)
End If
System.Threading.Thread.Sleep(50)
GameConnection.SendKeyTo(Keys.OemSemicolon)
System.Threading.Thread.Sleep(2000)
GameConnection.SendKeyTo(Keys.K)
System.Threading.Thread.Sleep(50)
GameConnection.SendKeyTo(Keys.Enter)
Catch AutoSaveExeption As GameException
If AutoSaveExeption.GameErrorCode = GameError.GAME_ERR_SENDMSG Then
' Send message error - connection to Game lost.
'
MessageBox.Show("cant make a connection.... can't autosave sadly", AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
SimConnectionBar.BackColor = Color.Red
End If
End Try
end sub
表中选择12个帖子。如果没有12个,我需要从posts
表中选择缺失。
parchive
错误:
$stmt = $db->query("SELECT * FROM posts where status='public' and user='public' order by inde asc limit 12 offset " . $offset);
$count1 = $stmt->rowCount();
if ($count1 < 12){
$diff = 12 - $count1;
$stmt = $db->query("SELECT * FROM posts where status='public' and user='public' order by inde asc limit 12 offset " . $offset .
" union select * from parchive where status='public' order by date desc limit " . $diff);
}
任何帮助?
答案 0 :(得分:2)
如果你需要限制和订单选择联合添加几个()围绕选择联合
$stmt = $db->query("(SELECT *
FROM posts
where status='public' and user='public'
order by inde asc limit 12 offset " . $offset .
") union ( select *
from parchive where status='public' order by date desc limit " . $diff .")");
通过这种方式,UNION可以处理结果集,而不是直接选择