I want use Inner Join link 2 table and display in a datagridview.
For example,
PDC_FG Table contain PONO,Customer
Customer Table contain Customer, Zone
2 table has same field is Customer.
ConnectionStringSettings conSettings = ConfigurationManager.ConnectionStrings["MyDBConnectionString"];
string name = conSettings.ProviderName;
string providerName = conSettings.ProviderName;
string ConnectionString = conSettings.ConnectionString;
string sql = "SELECT PDC.PONO,PDC.Customer,Customer.Zone From PDC INNER JOIN Customer WHERE PDC.Customer=Customer.Customer";
OleDbConnection connection = new OleDbConnection(ConnectionString);
connection.Open();
sCommand = new OleDbCommand(sql, connection);
sAdapter = new OleDbDataAdapter(sCommand);
sBuilder = new OleDbCommandBuilder(sAdapter);
sDs = new DataSet();
sAdapter.Fill(sDs, "PDC_FG");
sTable = sDs.Tables["PDC_FG"];
connection.Close();
dataGridView1.DataSource = sDs.Tables["PDC_FG"];
dataGridView1.ReadOnly = true;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
These code cannot run.Hope any expert can help me.