現在已經嘗試了幾個小時以上。我正在嘗試使用Access Query填充數據集。該查詢在Access中正常工作,但不填充數據集中的任何內容。該查詢是一個視圖的過濾器。 例子: -無法使用Access OleDB填充數據集
Select Column1 as MyList
from (Select * from mytable
where Column1 like "'*" & Textbox1.Text &"*'"
or Column2 like "'*" & Textbox1.Text &"*'"
or Column3 like "'*" & Textbox1.Text &"*'")
union all
Select Column2
from (Select * from mytable
where Column1 like "'*" & Textbox1.Text &"*'"
or Column2 like "'*" & Textbox1.Text &"*'"
or Column3 like "'*" & Textbox1.Text &"*'")
union all
Select Column3
from (Select * from mytable
where Column1 like "'*" & Textbox1.Text &"*'"
or Column2 like "'*" & Textbox1.Text &"*'"
or Column3 like "'*" & Textbox1.Text &"*'")
我使用set作爲查詢字符串和使用的DataAdapter來填充數據集。 但這不起作用。我沒有得到任何錯誤。數據只是不顯示在數據集中。
代碼: -
Dim da as new OledbAdapter(sqlstring,myconn)
Dim ds as New Dataset
myconn.open()
da.fill(ds,"TableName")
myconn.close()
我相信這事做訪問查詢時,查詢表是一個視圖。任何建議/解決方法,將不勝感激。
乾杯, 阿米爾
爲什麼每行末尾都有雙引號?把它換成&「*'」&_ – Steve
剛回來,並輸入它。對不起隊友。已修復 –
_Dim cmd =「SELECT ....... WHERE Column1 Like'*」&textBox1.Text&「*'or Column2 Like'*」&textBox2.Text&「*'...... ...「_ – Steve