Re: [.NET] 讀取輸入的字來呼叫資料表的資料列

看板Visual_Basic作者 (空瓶子)時間17年前 (2007/05/04 12:52), 編輯推噓6(605)
留言11則, 3人參與, 最新討論串4/4 (看更多)
※ 引述《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)

05/04 16:22, , 1F
請問pk是什麼意思@@a
05/04 16:22, 1F

05/04 20:06, , 2F
Primary Key 主索引
05/04 20:06, 2F

05/05 00:15, , 3F
哦哦 了解. 感謝~我去試試..
05/05 00:15, 3F

05/05 17:27, , 4F
怪 我在Access有設主索引鍵 可是程式compiler說沒主鍵..
05/05 17:27, 4F

05/06 01:21, , 5F
dim col as datacolumn
05/06 01:21, 5F

05/06 01:22, , 6F
col=objdataset.tables("XXX").columns("id")
05/06 01:22, 6F

05/06 01:24, , 7F
objdataset.tables("XXX").primarykey=col
05/06 01:24, 7F

05/06 04:50, , 8F
唔 型別不符..上面那句有預設什麼型態嗎 我主鍵有設int了
05/06 04:50, 8F

05/06 04:52, , 9F
可是他跟我說無法轉成int 囧
05/06 04:52, 9F

05/06 14:04, , 10F
col.DataType = System.Type.GetType("System.Int32") 試試
05/06 14:04, 10F

05/06 15:08, , 11F
還是一樣..orz
05/06 15:08, 11F
文章代碼(AID): #16EhmhNL (Visual_Basic)
文章代碼(AID): #16EhmhNL (Visual_Basic)