-2
I’m doing a little project in my college and I started to work with classes in c#, but I’m finding problems when it comes to inserting (my amount of values in Insert does not match values) in my BD and I don’t understand. my User class:
private int _codigo;
private string _senha, _username;
private byte[] _vetorImagens;
public int Codigo
{
get
{
return _codigo;
}
set
{
_codigo = value;
}
}
public string Senha
{
get
{
return _senha;
}
set
{
_senha = value;
}
}
public string Username
{
get
{
return _username;
}
set
{
_username = value;
}
}
public byte[] VetorImagens
{
get
{
return _vetorImagens;
}
set
{
_vetorImagens = value;
}
}
public string Inserir()
{
return "insert into Usuario(Username,Senha,Foto) values ('" + _username+ "''" + _senha + "''" + _vetorImagens +"')";
}
}
}
Welcome to stackpt! Your code alone does not Insert, it just returns a string. Can you show us how you are actually doing Insert? Also as answer below the syntax of your SQL is wrong, commas are missing.
– Genos