2008 年,我想将 txtEmpNo 绑定到 txtFullName。但我检查了专栏是正确的。
错误“无法绑定到数据源上的属性或列 [First Name]。参数名称:dataMember”
此代码:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim da3 As New SqlDataAdapter
Dim ds3 As New DataSet()
Dim bs2 As New BindingSource()
Dim sql As String = "SELECT Employee.[First Name] From Employee WHERE Employee.EmployeeNo = '" & txtEmpNo.Text.ToString & "'"
da3 = New SqlDataAdapter(sql, Conn)
da3.Fill(ds3, "Employee")
If ds3.Tables("Employee").Rows.Count > 0 Then
txtFullName.DataBindings.Add(New Binding("Text", ds3, "Employee.[First Name]"))
txtFullName.DataBindings.Clear()
Else
txtFullName.Text = ""
End If
End Sub
谢谢你的时间。