You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to import data into a temporary table using the same connection.
I manually tried adding some values and it works, but when using BulkInsert() gives me an error:
RepoDb.Exceptions.MissingFieldsException: 'There are no database fields found for table '[dbo].[##TempTable]'. Make sure that the target table '[dbo].[##TempTable]' is present in the database and/or at least a single field is available.'
This is my code:
public static void ImportDocuments(List<ArtsoftDoc> docList)
{
CreateTemporaryTable();
var toMergeList = docList.Select(doc => new ArtsoftDocDTOTemp(doc)).AsList();
var temp = con.ExecuteQuery("SELECT * FROM ##TempTable");
con.ExecuteNonQuery("INSERT INTO ##TempTable (Doc_ID, DocType, DocNumber) VALUES (1, 1, 1)");
temp = con.ExecuteQuery("SELECT * FROM ##TempTable");
con.BulkInsert(toMergeList);
}
[Map("[dbo].[##TempTable]")]
public class ArtsoftDocDTOTemp
{
public int Doc_ID { get; set; }
public int DocType { get; set; }
public long DocNumber { get; set; }
public int Partner_ID { get; set; }
public string PartnerName { get; set; }
public string ReferenceDoc { get; set; }
public int VendorNumber { get; set; }
public int DocDate { get; set; }
public int DueDate { get; set; }
public decimal VATAmount { get; set; }
public decimal NetAmount { get; set; }
public decimal DocTotal { get; set; }
public int Year { get; set; }
public decimal Balance { get; set; }
public bool IsCanceled { get; set; }
public string DocumentNumber { get; set; }
}
The text was updated successfully, but these errors were encountered:
I'm trying to import data into a temporary table using the same connection.
I manually tried adding some values and it works, but when using BulkInsert() gives me an error:
This is my code:
The text was updated successfully, but these errors were encountered: