讓我們覺得我的SQL查詢使用OleDbDataReader
select customerDetials.custid,TestTable.col1 from CustomerDetails INNER JOIN TestTable on CustomerDetails.custid=TestTables.custid where CustomerDetails.custid>0
我想使用OleDbDataReader來檢索該行檢索值。
我用這樣的方式
while (dataReader.Read())
{
string str= dataReader["customerDetials.custid"].ToString();
}
但概率是在這裏參加在那裏,所以如果我給列名狀高於其拋出了我的異常,我無法使用索引或我不能改變SQL查詢那麼有什麼方法可以使用列名來檢索數據嗎?
yeah ..tried ..但拋出一個異常,它不適當也coz連接表也可能有同名的禮拜儀式..所以它不會有效。 – Bhaswanth 2010-08-12 11:29:27
選擇很好。保持原樣。返回的結果應該有2列,custid和col1。 – 2010-08-12 11:30:39
在這種情況下,我dnt有查詢中的TestTable.custid ...認爲我們有它..coz我的查詢是動態的我不知道它是如何來到..所以我不喜歡寫儘可能一般。 – Bhaswanth 2010-08-12 11:33:09