There is a custom object(ex company) and list of custom object (ex employee) which needs to be saved in a BLOB datatype, Below is the piece of code I have tried without success. I have tried DbType.Binary
but it did not workout.
Below is the piece of insert query :
sql_cmd.Parameters.Add("@company", DbType.Byte);
sql_cmd.Parameters["@company"].Value = (Company)root.company;
sql_cmd.Parameters.Add("@employees", DbType.Byte);
sql_cmd.Parameters["@employees"].Value = ((List< Employee >))root.employeeList;
Exception :
System.FormatException was unhandled by user code.
Message=Input string was not in a correct format.
Below is the associated classes
class Company
{
public string id { get; set; }
public string name { get; set; }
public List<Package> packages { get; set; }
public string description { get; set; }
}
class Employee
{
public string id { get; set; }
public string name { get; set; }
public object description { get; set; }
public Address address { get; set; }
public Contact contact { get; set; }
public string enterpriseId { get; set; }
public object createdDate { get; set; }
public object modifiedDate { get; set; }
}
Aucun commentaire:
Enregistrer un commentaire