ROTINA DELETE
Galera é o seguinte, fiz a rotina de inclusao e alteração, agora a de Delete não funfa, ele deleta a primeira linha, bom vo por as 2 rotinas, se a;guem puder me ajudar agradeço des de ja.
Abraços
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection Conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\ am\\Desktop\\Adriano\\pro_dot.net\\c#\\Ado.C\\Banco.mdb;Persist Security Info=False");
Conn.Open();
OleDbDataAdapter Da = new OleDbDataAdapter("Select * From Tabela order by id", Conn);
DataSet Ds = new DataSet();
Da.Fill(Ds, "Tabela");
DataRow Dr = Ds.Tables ["Tabela"].NewRow();
Dr["Id"] = textBox1.Text;
Dr["Nome"] = textBox2.Text;
Ds.Tables["Tabela"].Rows.Add(Dr);
OleDbCommandBuilder cmdB = new OleDbCommandBuilder(Da);
Da.Update(Ds, "Tabela");
data.DataSource = Ds.Tables["Tabela"];
Da.Dispose();
Ds.Dispose();
cmdB.Dispose();
Conn.Dispose();
}
private void button2_Click(object sender, EventArgs e)
{
OleDbConnection Conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\ am\\Desktop\\Adriano\\pro_dot.net\\c#\\Ado.C\\Banco.mdb;Persist Security Info=False");
Conn.Open();
OleDbDataAdapter Da = new OleDbDataAdapter("Select * From Tabela order by id", Conn);
DataSet Ds = new DataSet();
Da.Fill(Ds, "Tabela");
DataRow Dr = Ds.Tables["Tabela"].Rows[0];
Dr["Nome"] = textBox2.Text;
OleDbCommandBuilder Cb = new OleDbCommandBuilder(Da);
Da.Update(Ds,"Tabela");
data.DataSource = Ds.Tables["Tabela"];
Da.Dispose();
Ds.Dispose();
Cb.Dispose();
Conn.Dispose();
}
Abraços
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection Conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\ am\\Desktop\\Adriano\\pro_dot.net\\c#\\Ado.C\\Banco.mdb;Persist Security Info=False");
Conn.Open();
OleDbDataAdapter Da = new OleDbDataAdapter("Select * From Tabela order by id", Conn);
DataSet Ds = new DataSet();
Da.Fill(Ds, "Tabela");
DataRow Dr = Ds.Tables ["Tabela"].NewRow();
Dr["Id"] = textBox1.Text;
Dr["Nome"] = textBox2.Text;
Ds.Tables["Tabela"].Rows.Add(Dr);
OleDbCommandBuilder cmdB = new OleDbCommandBuilder(Da);
Da.Update(Ds, "Tabela");
data.DataSource = Ds.Tables["Tabela"];
Da.Dispose();
Ds.Dispose();
cmdB.Dispose();
Conn.Dispose();
}
private void button2_Click(object sender, EventArgs e)
{
OleDbConnection Conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\ am\\Desktop\\Adriano\\pro_dot.net\\c#\\Ado.C\\Banco.mdb;Persist Security Info=False");
Conn.Open();
OleDbDataAdapter Da = new OleDbDataAdapter("Select * From Tabela order by id", Conn);
DataSet Ds = new DataSet();
Da.Fill(Ds, "Tabela");
DataRow Dr = Ds.Tables["Tabela"].Rows[0];
Dr["Nome"] = textBox2.Text;
OleDbCommandBuilder Cb = new OleDbCommandBuilder(Da);
Da.Update(Ds,"Tabela");
data.DataSource = Ds.Tables["Tabela"];
Da.Dispose();
Ds.Dispose();
Cb.Dispose();
Conn.Dispose();
}
Bom parei de usar o datarow e estou fazendo as quer normalmente.
Tópico encerrado , respostas não são mais permitidas