作者Phill (空瓶子)
看板Visual_Basic
標題Re: [.NET] 讀取輸入的字來呼叫資料表的資料列
時間Fri May 4 12:52:56 2007
※ 引述《siaujan (...)》之銘言:
恕刪 假設 id name (id int
pk)
================
100 jack
101 tommy
pos=101
Sub ShowRecord(ByVal pos As Integer)
Dim objRow As DataRow
objRow = objDataSet.Tables("comicDB").Rows.Find(pos)
'id
if not (objRow
is nothing)
then
'TextBox6.Text = objRow("PW")
TextBox2.Text = objRow("name").tostring
'Get "tommy"
'TextBox3.Text = objRow("性別")
'TextBox4.Text = objRow("聯絡電話")
'TextBox5.Text = objRow("出生日期")
else
'not find
end if
End Sub
--
◢████
█◤By Phill 創新科技,美化人生。
█ ╭══╮═╦╦╮╭══╮╭═╦╮╔══╮╮ ╮═╦╦ ╔══╮
█ █◤ ║╰╦╦ ╠╣ ║╰╦╦╠═╬╣╠═╦╮╰╦╦╯ ╠╣ ╠╣
█◣ ◤█◤║ ╠╣ ╠╣ ║ ╠╣║ ╠╣║ ╠╣ ╠╣ ╠╣ ║╰╔╗
◥██◤ ◤ ╰═╩╯╰╩╩═╰═╩╯╰ ╰╝╚═╩╯ ╰╝ ╚╝ ╚═╩╯
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.147.250
※ 編輯: Phill 來自: 220.132.147.250 (05/04 12:54)
推 siaujan:請問pk是什麼意思@@a 05/04 16:22
推 fumizuki:Primary Key 主索引 05/04 20:06
→ siaujan:哦哦 了解. 感謝~我去試試.. 05/05 00:15
推 siaujan:怪 我在Access有設主索引鍵 可是程式compiler說沒主鍵.. 05/05 17:27
推 Phill:dim col as datacolumn 05/06 01:21
→ Phill:col=objdataset.tables("XXX").columns("id") 05/06 01:22
→ Phill:objdataset.tables("XXX").primarykey=col 05/06 01:24
→ siaujan:唔 型別不符..上面那句有預設什麼型態嗎 我主鍵有設int了 05/06 04:50
→ siaujan:可是他跟我說無法轉成int 囧 05/06 04:52
推 Phill:col.DataType = System.Type.GetType("System.Int32") 試試 05/06 14:04
推 siaujan:還是一樣..orz 05/06 15:08