Tengo este codigo que es para login
MySqlConnection con = new MySqlConnection("server=localhost; userid=root; database=registro");
try
{
//consulta a ser ejecutada
MySqlCommand com = new MySqlCommand("SELECT usuario,pass FROM tabla_registro WHERE usuario='" + text_usuario_ingresar.Text + "' and pass='" + text_contraseña_ingresar.Text + "'",con);
con.Open();
com.ExecuteNonQuery();
DataSet ds = new DataSet();
MySqlDataAdapter ad = new MySqlDataAdapter(com);
ad.Fill(ds, "tabla_registro");
DataRow dr;
dr = ds.Tables["tabla_registro"].Rows[0];
if ((text_usuario_ingresar.Text == dr["usuario"].ToString()) || (text_contraseña_ingresar.Text == dr["pass"].ToString()))
{
Form_servidor form = new Form_servidor();
form.Show();
}
}
catch { }
finally
{
con.Close();
}
ya he logrado insertar los datos de usuario y contraseña en mysql, el problema es que no puedo obtener el ultimo dato de usuario y contraseña para que se habra un nuevo form ya que me toma todos los registro para usuario y contraseña de la tabla o sea me toma los registro antiguos y los nuevos y yo solo quiero el ultimo registro que tome y habra el nuevo form
usuario contraseña
d d
p p
y me habre el form tanto con p o con d como usuario y contraseña, cosa que no quiero quiero que me habra con p en este caso o con un nuevo registro que inserte
Loading
Posted Jul 5, 2013, 10:07 AM
I have managed to insert data in mysql user and password, the problem is that I can not get the last user data and password that will be a new form and it takes me all records for user and password of the table or registration takes me old and new and I just want the last record and there will take the new form
Can you please post the question in english to get quick answers?