private void Form1_Load(object sender, EventArgs e) { OleDbConnection con = new OleDbConnection(constr); OleDbCommand cmd = new OleDbCommand(); cmd.Connection = con; cmd.CommandText = "select property_name,propertytype_id from tb_property "; cmd.CommandType = CommandType.Text; OleDbDataAdapter da = new OleDbDataAdapter(); da.SelectCommand = cmd; DataSet ds = new DataSet(); da.Fill(ds); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { for (int j = 0; j < 2; j++) { dataGridView1.Rows.Add(new DataGridViewRow()); dataGridView1.Rows[i].Cells[j].Value = ds.Tables[0].Rows[i][j].ToString(); } } con.Close(); }
"select a.property_name,a.propertytype_id , b.propertytype_value from tb_property a inner join tb_property_type b on a.propertytype_id = b.propertytype_id"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)