2012-04-27 47 views
1

我使用的Visual Studio(VB),我有一個問題,從dataTable中獲得ID與數據集

我使用的Microsoft.Office.Interop.Excel讀取從Excel中的數據,

--Students_Table-- 
id_S | Name | Sex 
12  john M 

---Excel file------ 
name | address 
john NY 

-----這裏上傳excel文件saved--表

id_u | id-S | Scor | 
1  12  30 

我想從「約翰」得到Id_S(Excel文件),我嘗試使用的數據集查詢

select Id_P from Students_Table where (Name =: Name) 

,然後檢查fillBy & GetBy

我的VB代碼:

Dim ta As New Students_TableAdapters.StudentsTableAdapter 
Dim DataID as Integer 
if ta.fillBy(ExlRead.Value) <> 0 then 
DataId = ta.fillBy(ExlRead.Value) 
else 
exception("The Name Cannot Found on Database") 
end if 

我使用斷點來檢查這些,我發現一個錯誤消息

「ORA-01722:無效號碼「

(我使用Oracle數據庫)

,如果我提出我的光標移動到ta.fillBy它顯示Public Overridalle Overload Function FillBy(Name as string) as decimal

注: 我'使用Oracle數據庫

+0

感謝的@arion修正觀點 – user1258887 2012-04-27 06:58:32

+0

沒問題..... – Arion 2012-04-27 07:10:01

回答

0

新手 更換

ta.fillBy(ExlRead.Value) 

通過

CInt(ta.fillBy(CInt(ExlRead.Value)))