0
你好我有一個問題,當我點擊進入數據網格我總是得到這個問題我目前正在做這個更新,我使用數據網格視圖使我更容易點擊數據網格,更新按鈕將被啓用,當我點擊更新按鈕時,它將進入form4維護模塊。但不幸的是,錯誤「從類型'DBNull'轉換類型'字符串'是無效的」得到的總是在我的方式,所以我可以到那一部分,請幫助我的謝謝,再次抱歉我的英語不好:))DBNull類型字符串是無效--- Visual Studio 2005
Form4.txtEmpLastname.Text = dgvEmployeeRecords.Item("Lastname", dgvEmployeeRecords.CurrentRow.Index).Value
Form4.txtEmpFirstname.Text = dgvEmployeeRecords.Item("Firstname", dgvEmployeeRecords.CurrentRow.Index).Value
Form4.txtEmpMiddlename.Text = dgvEmployeeRecords.Item("Middlename", dgvEmployeeRecords.CurrentRow.Index).Value
Form4.txtEmpAddress.Text = dgvEmployeeRecords.Item("CityAddress", dgvEmployeeRecords.CurrentRow.Index).Value
Form4.txtEmpAge.Text = dgvEmployeeRecords.Item("Age", dgvEmployeeRecords.CurrentRow.Index).Value
Form4.txtEmpBirthdate.Text = dgvEmployeeRecords.Item("Birthdate", dgvEmployeeRecords.CurrentRow.Index).Value
Form4.txtEmpBirthplace.Text = dgvEmployeeRecords.Item("Birthplace", dgvEmployeeRecords.CurrentRow.Index).Value