I am trying to learn different ways to load a DataGridView control.
This code below works just fine:
The Query below placed in the DGV control or in the TableAdaptor don't work. A blank DGB is returned. What is wrong??
This code below works just fine:
Working Code:
'**** Fill DGV with desired Managers Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click DataGridView1.Visible = True Dim FoundIndex As Integer = ManagersTableBindingSource.Find("Mgr-LN", TextBox1.Text) If FoundIndex > -1 Then ' see if Manager found '**** just examples of how to get these values - not needed for this Click event Dim RowNum As Integer = DataGridView1.CurrentRow.Index ' index is 0 based txtRowNum.Text = RowNum.ToString() '**** '**** This causes the DGV to fill with all Managers with a LN equal to TextBox1.Text ManagersTableBindingSource.Filter = "[Mgr-LN] = '" & TextBox1.Text & "'" '**** Else MsgBox("Manager not found") TextBox1.Text = "" End If End Sub
The Query below placed in the DGV control or in the TableAdaptor don't work. A blank DGB is returned. What is wrong??
NonWorking Query Code:
SELECT [Mgr-NameLNFN], [Mgr-FN], [Mgr-LN], [Mgr-Title], [Mgr-StartDte], [Mgr-TermDate], [Mgr-NumSP], [Mgr-Password], [Mgr-FNLN], [Mgr-KntDailySpFU], [Mgr-KntWeeklySpFU], [Mgr-EmailLogonName], [Mgr-EmailLogonPW], [Mgr-EmailAddr], [Mgr-CurYrGoalM1], [Mgr-CurYrGoalM2], [Mgr-CurYrGoalM3], [Mgr-CurYrGoalM4], [Mgr-CurYrGoalM5], [Mgr-CurYrGoalM6], [Mgr-CurYrGoalM7], [Mgr-CurYrGoalM8], [Mgr-CurYrGoalM9], [Mgr-CurYrGoalM10], [Mgr-CurYrGoalM11], [Mgr-CurYrGoalM12], [Mgr-CurYrUnitsM1], [Mgr-CurYrUnitsM2], [Mgr-CurYrUnitsM3], [Mgr-CurYrUnitsM4], [Mgr-CurYrUnitsM5], [Mgr-CurYrUnitsM6], [Mgr-CurYrUnitsM7], [Mgr-CurYrUnitsM8], [Mgr-CurYrUnitsM9], [Mgr-CurYrUnitsM10], [Mgr-CurYrUnitsM11], [Mgr-CurYrUnitsM12], [Mgr-PrevYrUnitsM1], [Mgr-PrevYrUnitsM2], [Mgr-PrevYrUnitsM3], [Mgr-PrevYrUnitsM4], [Mgr-PrevYrUnitsM5], [Mgr-PrevYrUnitsM6], [Mgr-PrevYrUnitsM7], [Mgr-PrevYrUnitsM8], [Mgr-PrevYrUnitsM9], [Mgr-PrevYrUnitsM10], [Mgr-PrevYrUnitsM11], [Mgr-PrevYrUnitsM12], [Mgr-NumKey] FROM ManagersTable WHERE ([Mgr-LN] = '" & searchln & "')