A small problem appeared, which in my old application worked normally.
My DAL Class is not connecting in Mysql. Being all the connection parameters, I believe it is correct.
MyDALthatmakestheconnection.
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingGeax1.Model;usingMySql.Data;usingMySql.Data.MySqlClient;namespaceGeax1.DAL{publicclassVeiculosDAL{publicstaticvoidcadastra(_Veiculosobj){using(varconn=newMySqlConnection("server=127.0.0.1;Database=xpto;User ID=root;Password='';"))
{
try
{
conn.Open();
String InsertVeiculos = ("INSERT INTO tab_veiculo (placa,quilometragem,cor,tipo,ano,chassi,modelo) VALUES(@placa, @cor, @tipo, @ano, @chassi, @modelo)");
MySqlCommand cmd = new MySqlCommand();
cmd.CommandText = InsertVeiculos;
cmd.Connection = conn;
cmd.Parameters.AddWithValue("@placa", obj.Placa1);
cmd.Parameters.AddWithValue("@quilometragem", obj.Quilometragem1);
cmd.Parameters.AddWithValue("@cor", obj.Cor1);
cmd.Parameters.AddWithValue("@tipo", obj.Tipo1);
cmd.Parameters.AddWithValue("@ano", obj.Ano1);
cmd.Parameters.AddWithValue("@chassi", obj.Chassi1);
cmd.Parameters.AddWithValue("@modelo", obj.Modelo1);
cmd.ExecuteNonQuery();
}
catch (Exception e)
{
throw e;
}
}
}
}
}
Note: My WAMP is on.