C# VB17 как выполнить автоматический поиск, когда я когда-либо набираю что-то в текстовом поле?
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;
using MySql.Data.MySqlClient;
namespace FileManagerTool
{
public partial class adminInterface : Form
{
public adminInterface(String Username)
{
InitializeComponent();
passValueLbl.Text = Username; // tut55 passing the value
load_table();
computerTime.Start(); // For ComputerTimer
}
}
DataTable dbdataset;
void load_table()
{
string constring = "datasource=localhost;port=3306;username=root;password=1412";
MySqlConnection conDatabase = new MySqlConnection(constring);
MySqlCommand cmdDatabase =
new MySqlCommand("Select eid as `Employee ID`," +
"name AS `First Name`," +
"surname AS `Last Name`," +
"age AS `Age`," +
"user_name AS `Username`," +
"password AS `Password` ," +
"gender AS `gender` " +
"from `database`.`edata`;", conDatabase);
// Select * from `database`.`edata`;
// Select eid,name,age,user_name,password from `database`.`edata`;
try
{
MySqlDataAdapter sda = new MySqlDataAdapter();
sda.SelectCommand = cmdDatabase;
dbdataset = new DataTable();
sda.Fill(dbdataset);
BindingSource bSource = new BindingSource();
bSource.DataSource = dbdataset;
edataGridView.DataSource = bSource;
sda.Update(dbdataset);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void searchBox_TextChanged(object sender, EventArgs e)
{
DataView DV = new DataView(dbdataset);
DV.RowFilter = string.Format("name like '%{0}%'", searchBox.Text); // !!ERROR!! //
edataGridView.DataSource = DV;
}
What I have tried:
i have tried few syntax, which i notice when i type somethings in the textbox its show a error which could not find the column name in the database, any help would be appreciate
i have stuck from this error for few week