1
This is my input code. Why is it wrong? What should I do?
public int abreOsParceiro(string os, string cnpj, string dataAbertura, string dataVisita, string tecnico)
{
WEBEntities db = new WEBEntities();
PDVOsParceiro pdv = new PDVOsParceiro();
List<string> lista = new List<string>();
try
{
pdv.CNPJ = cnpj;
pdv.DataAberturaOs = Convert.ToDateTime(dataAbertura);
pdv.DataVisita = Convert.ToDateTime(dataVisita);
pdv.Tecnico = tecnico;
pdv.OS = Convert.ToInt32(os);
db.T_OsParceiro.Add(pdv);==>> Aqui dá o erro
db.SaveChanges();
}
That is the mistake:
The best overloaded method match for 'System.Data.Entity.DbSet<V99SuporteTecnico.Models.T_OsParceiro>.Add(V99SuporteTecnico.Models.T_OsParceiro)' has some invalid arguments
What are the invalid arguments?
My class is so:
[Table(Name = "T_TarefaParceiro")]
public class PDVOsParceiro
{
[Column]
[DataMember]
public int IDTarefaParceiro { get; set; }
[Column]
[DataMember]
public int OS { get; set; }
[Column]
[DataMember]
public DateTime DataAberturaOs { get; set; }
[Column]
[DataMember]
public string CNPJ { get; set; }
...............
Is that right or not?
You would need to know your class declaring what the member is
T_OsParceiro
ofdb
and check what the methodAdd
is waiting. There is some method there that awaits a typePDVOsParceiro
? If it does not exist, either you need to create or see if you can pass an element of another type or still see if it is possible to do cast for the expected type, which seems unlikely to me.– Maniero