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 System.Data.OleDb;
using System.IO;
namespace project1
{
public partial class frmSearch : Form
{
OleDbDataAdapter oda;
OleDbCommandBuilder ocb;
DataTable dt;
public frmSearch()
{
InitializeComponent();
}
private void btn_Search_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Student.mdb");
DataTable dt = new DataTable();
OleDbDataAdapter oda = new OleDbDataAdapter("SELECT tb_Student.Behaviour,tb_test.Test FROM tb_Student LEFT JOIN tb_test ON tb_Student.Fname = tb_test.Fname WHERE tb_Student.Fname = '" + this.txtSearch.Text + "'", conn);
oda.Fill(dt);
dataGridSearch.DataSource = dt;
}
}
}
มัน EROR ครับ
ก่อนทำ left join
Code (C#)
private void btn_Search_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Student.mdb");
DataTable dt = new DataTable();
OleDbDataAdapter oda = new OleDbDataAdapter("SELECT Behaviour,Day FROM tb_Student WHERE Fname = '" + this.txtSearch.Text + "'", conn);
oda.Fill(dt);
dataGridSearch.DataSource = dt;
}