Hello,
I am getting this error while I am running my code.(42601 : syntax error at or near "'Microsoft.ACE.OLEDB.12.0'"/)
using (var conn = new NpgsqlConnection(configuration.SqlServerConnectionString))
{
conn.Open();
var command = conn.CreateCommand();
command.CommandTimeOut = 600;
command.CommandType = System.Data.CommandType.Text;
command.CommandText = $@"{$"INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database = {ExportFile};')"}{$" 'SELECT *FROM[{Strings.ApprovalStartegyReport}]'"}
SELECT Country Code,
Legal Entity Name,
Type Name,
Subtype ID,
Subtype Name,
Template Barcode,
Template Name,
Approver Role,
Approver Roles's Order,
User First Name,
User Last Name,
User Position ID,
User Position Name,
Approver Line Manager First Name,
Approver Line Manager Last Name,
Approver Line Manager Position ID,
Approver Line Manager Position Name EN,
Approver Line Manager login
FROM public.ApprovalStartegyReport
WHERE Country Code IN(SELECT ELEMENT FROM public.func_Split(REPLACE(@country,'''',''),','))
ORDER BY Country Code, Legal Entity Name,Category Name,Type Name,Subtype Name,(CASE WHEN Template Barcode IS NULL THEN Flase ELSE True END),Template Barcode,Approver Role's Order;
command.Parameters.Add(new NpgsqlParameter("country",NpgsqlTypes.NpgsqlDbType.Varchar));
command.Parameters["country"].Value = countries;
command.ExecuteNonQuery();
}
this is my code, while I am running this code I am Getting the error : 42601 : syntax error at or near "'Microsoft.ACE.OLEDB.12.0'"/,
could you please explain me the issue and how can I resolve the error.
Thanks,