1
txtAddress.Text = DB.ProfileDataset.Tables("tblCustomers").Rows.Item("Address").toString
上面的代碼生成的選項嚴格在隱式轉換不允許下項從「字符串」到「整數」錯誤的隱式轉換(「地址」) 我不知道我做錯了什麼...選項嚴格On不允許從「字符串」到「整數」
txtAddress.Text = DB.ProfileDataset.Tables("tblCustomers").Rows.Item("Address").toString
上面的代碼生成的選項嚴格在隱式轉換不允許下項從「字符串」到「整數」錯誤的隱式轉換(「地址」) 我不知道我做錯了什麼...選項嚴格On不允許從「字符串」到「整數」
DataRowCollection.Item屬性需要一個整數用於行索引。
我覺得你的語法如下之後:
txtAddress.Text = DB.ProfileDataset.Tables("tblCustomers").Rows(0)("Address").ToString()
編輯
東西要記住:
original code
= DB.ProfileDataset.Tables("tblCustomers").Rows.Item("Address").toString
compiler sees
= DB.ProfileDataset.Tables.Item("tblCustomers").Rows.Item("Address").toString
fixed code
= DB.ProfileDataset.Tables("tblCustomers").Rows(0)("Address").ToString()
compiler sees
= DB.ProfileDataset.Tables.Item("tblCustomers").Rows.Item(0).Item("Address").ToString()