Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

C sharp joined tables

774919Jun 8 2010 — edited Jun 8 2010
I have a DataGridView made by a join of two tables ( C# - working in Visual Studio): "etapa" and "lucrare_licenta" from my database. Does smbdy know how can i update these two tables simultaneously?
This code works ony for a table..i saw a tutorial on asktheoracle.net as an example...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;
namespace ex
{
public partial class Situatie_studenti_vs_etape : Form
{
public int ID_ps=0;
private DataSet ds;
private OracleDataAdapter da;


public Situatie_studenti_vs_etape(int x)
{
InitializeComponent();

}


private void button1_Click(object sender, EventArgs e)
{
string sql = "select e.* from etapa e "
+ "inner join lucrare_licenta l "
+ "on l.id_lic=e.id_lic "
+ "where l.id_stud = (select s.id_stud from student s "
+ "inner join lucrare_licenta l "
+ "on l.id_stud=s.id_stud "
+ "where nume||' '||initiala_tatalui||' '||prenume||' - id '||s.id_stud = '"comboBox1.Text"') order by e.id_etapa";

OracleConnection conn = new OracleConnection();
OracleCommand cmd;
OracleCommandBuilder cb;
conn.ConnectionString = "User Id=*****;Password=*****;Data Source=*****";
conn.Open();
cmd = new OracleCommand(sql, conn);
cmd.CommandType = CommandType.Text;
da = new OracleDataAdapter(cmd);

cb = new OracleCommandBuilder(da);
ds = new DataSet();
da.Fill(ds,"etapa");
da.Fill(ds,"lucrare_licenta");

dataGridView1.DataSource = ds.Tables[0];

}

//code for UPDATE button:

private void button2_Click(object sender, EventArgs e)
{
da.Update(ds,"etapa");

}

}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 6 2010
Added on Jun 8 2010
1 comment
547 views