DarkWatch
gracias por tu ayuda bueno pongo el codigo para que vean como quedo y para que les ayude a otros en caso de que tenga el mismo problema lo unico que hise fue crear otra variable Sql2 para que no hubiera confucion y solo cree otro(Com.CommandText = Sql2;
x = Com.ExecuteNonQuery();) para que fuera mas en orden:
Código C#:
Ver originalOleDbConnection BaseDatos = new OleDbConnection();
OleDbCommand Com = new OleDbCommand();
string Sql,Sql2;
int x;
BaseDatos.ConnectionString = @"PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\doggy_park.mdb";
BaseDatos.Open();
Com.Connection = BaseDatos;
Com.CommandType = CommandType.Text;
Sql = "INSERT INTO Cliente ( nombre, apellido,direccion, mail, mascota, raza, color, señas, fecha_entra, fecha_sale, edad, M, F,tipo_mascota,otro,letra,telefono)";
Sql = Sql + "SELECT '" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox1.Text + "','" + dateTimePicker1.Text + "','" + dateTimePicker2.Text + "','" + comboBox1.Text + "','" + radioButton1.Checked + "','" + radioButton2.Checked + "','" + checkBox1.Tag + "','" + richTextBox1.Text + "','" + miLetra + "'," + textBox5.Text + ";";
Com.CommandText = Sql;
x = Com.ExecuteNonQuery();
Sql2 = "INSERT INTO comportamiento(mascota,dueno,num)";
Sql2 = Sql2 + "SELECT '" + textBox2.Text + "','" + textBox7.Text + "'," + textBox5.Text + ";";
Com.CommandText = Sql2;
x = Com.ExecuteNonQuery();
BaseDatos.Close();
ahora en el asunto del update tengo este problema me manda el siguente error "no se han especificado valores para algunos de los parametros requeridos"
este es el codigo que manejo:
Código C#:
Ver originalOleDbConnection BaseDatos = new OleDbConnection();
OleDbCommand Com = new OleDbCommand();
string Sql;
int x;
BaseDatos.ConnectionString = @"PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\doggy_park.mdb";
BaseDatos.Open();
Com.Connection = BaseDatos;
Com.CommandType = CommandType.Text;
Sql = "UPDATE [Cliente] set [nombre] = " + textBox2.Text + ", apellido = " + textBox3.Text + " ,telefono=" + textBox5.Text + " where [id] = "+textBox1.Text+";";
Com.CommandText = Sql;
x = Com.ExecuteNonQuery();
if (x > 0)
{
MessageBox.Show("SE HAN GUARDADO LOS REGISTROS EN LA BASE DE DATOS", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Information);
textBox2.Clear();
textBox3.Clear();
textBox5.Clear();
}
else
{
MessageBox.Show("NO SE HAN PODIDO GUARDAR LOS REGISTROS EN LA BASE DE DATOS FAVOR DE LLENAR EL SIGUIENTE CAMPO: TELEFONO", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}