Employee Search Create an application that connects to the Personnel.mdf database that you created in Programming Problem 1. The application's form should display the Employee table in a DataGridView control. The application should let the user specify a name in a text box and then search for that name in the Employee table. The application should display any rows that contain a full or partial match of the specified name. Need help with my code. Not properly pulling up the names. SQL code: SELECT Id, Name, Position, HourlyPay FROM dbo.Employee WHERE Name LIKE '%' C# Code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Name_Search { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void employeeBindingNavigatorSaveItem_Click(object sender, EventArgs e) { this.Validate(); this.employeeBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll(this.personnelDataSet); } private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'personnelDataSet.Employee' table. You can move, or remove it, as needed. this.employeeTableAdapter.Fill(this.personnelDataSet.Employee); } private void nameSearchButton_Click(object sender, EventArgs e) { this.employeeTableAdapter.FillBySearchName(this.personnelDataSet.Employee); } private void nameSearchTextBox_TextChanged(object sender, EventArgs e) { this.employeeTableAdapter.FillBySearchName(this.personnelDataSet.Employee); } } }
Employee Search
Create an application that connects to the Personnel.mdf
Need help with my code. Not properly pulling up the names.
SQL code:
SELECT Id, Name, Position, HourlyPay FROM dbo.Employee WHERE Name LIKE '%'
C# Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Name_Search
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void employeeBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.employeeBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.personnelDataSet);
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'personnelDataSet.Employee' table. You can move, or remove it, as needed.
this.employeeTableAdapter.Fill(this.personnelDataSet.Employee);
}
private void nameSearchButton_Click(object sender, EventArgs e)
{
this.employeeTableAdapter.FillBySearchName(this.personnelDataSet.Employee);
}
private void nameSearchTextBox_TextChanged(object sender, EventArgs e)
{
this.employeeTableAdapter.FillBySearchName(this.personnelDataSet.Employee);
}
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images