我已經有多個addwithvalue查詢值Mysql的多個addwithvalue:一個返回值足夠
IDCheck.CommandText = "SELECT * FROM cloudposgebruikers WHERE id = @id AND licentie1hc = @lc1 AND licentie2hc = @lc2"
+ " AND licentie3hc = @lc3 AND licentie4hc = @lc4 AND licentie5hc = @lc5 AND licentie6hc = @lc6 AND licentie7hc = @LC7 AND licentie8hc = @lc8"
+ " AND licentie9hc = @lc9 AND licentie10hc = @lc10";
IDCheck.Parameters.AddWithValue("@id", licenseid);
IDCheck.Parameters.AddWithValue("lc1", GetId);
IDCheck.Parameters.AddWithValue("lc2", GetId);
IDCheck.Parameters.AddWithValue("lc3", GetId);
IDCheck.Parameters.AddWithValue("lc4", GetId);
IDCheck.Parameters.AddWithValue("lc5", GetId);
IDCheck.Parameters.AddWithValue("lc6", GetId);
IDCheck.Parameters.AddWithValue("lc7", GetId);
IDCheck.Parameters.AddWithValue("lc8", GetId);
IDCheck.Parameters.AddWithValue("lc9", GetId);
IDCheck.Parameters.AddWithValue("lc10", GetId);
當然,這會比較所有這些值,並只有當所有值都存在返回true
比方說,只有 「licentie5hc」 和 「ID」 匹配=>返回true
還是讓我們說只有 「ID」 和licentie1hc」匹配.. =>返回true
是這可能嗎?我知道我可以使用不同的查詢的,但我只需要「ID」和「licentie X HC」參數相匹配的一個...
如果我有足夠代表我會送給你一個+1快速和良好的答案..謝謝! – DeMama 2013-03-10 15:57:38
thx!查看rs答案,他發現了一些我沒有大大簡化代碼的東西。 – 2013-03-10 15:58:25
呵呵不,我們不能改變我們的數據庫結構,這是我們的許可證制度的一部分,所以沒有其他選擇..但無論如何感謝:D – DeMama 2013-03-11 19:46:12