У меня есть 3 таблицы в базе данных как:
- Emp (имя, номер мобильного телефона, оплата, дата присоединения)
- Addmoney (имя, дата_адреса, тип)
- AddDate (name, Leaving_Date)
Я хочу отображать только эти столбцы из этих трех таблиц (имя, оплата, Date_of_money_Taken, Joining_date, Leaving_date), когда пользователь вводит любое имя, хранящееся в таблице Emp в TextBox, у меня есть проблема в коде ниже. Это бросает это:
Exception({"The multi-part identifier \"name.Text\" could not be bound."})
private void ShowEmp_Load(object sender, EventArgs e)
{
// create the connection string
connectionString = GetConnectionString();
connection = new SqlConnection(connectionString);
queryString = "select Emp.name,Emp.Payment,Emp.JoiningDate,Addm.Date,AddDate.LeavingDate from Emp,Addm,AddDate where name.Text='" + name + " ' ";// Select * From Emp
// create an SqlDataAdapter to execute the query
dAdapter = new SqlDataAdapter(queryString, connection);
// create a command builder
cBuilder = new SqlCommandBuilder(dAdapter);
// create a datatable to hold query results
dTable = new DataTable();
// fill DataTable
dAdapter.Fill(dTable);<-EXCEPTION({"The multi-part identifier \"name.Text\" could not be bound."})
// the DataGridView
//DataGridView dataGridView1 = new DataGridView();
// BindingSource to sync DataTable and DataGridView
bSource = new BindingSource();
// set the BindingSource DataSource
bSource.DataSource = dTable;
// set the DataGridView DataSource
dataGridView1.DataSource = bSource;
}