U
U
User992020-04-21 17:32:27
ASP.NET
User99, 2020-04-21 17:32:27

Why is the query in the database not working and getting an error 500?

When querying the database, an error 500 constantly falls out. I can’t understand why, I seem to be doing everything right.
I use Dapper+Postgres

Controller

TestResults results = await reposTestResults.CheckTestStart(iin, id, now_date, 1);


repository
public async Task<TestResults> CheckTestStart(string iin, int test_id, DateTime date, int status)
        {
            using (IDbConnection dbConnection = Connection)
            {
                dbConnection.Open();
                return (await dbConnection.QueryAsync<TestResults>("SELECT * FROM tester.test_results WHERE [email protected] AND [email protected]_id AND [email protected]_date AND [email protected]", new { iin = iin, test_id = test_id, result_date = date, status = status })).FirstOrDefault();
            }
        }


Model
public class TestResults: BaseEntity
    {
        public int id { get; set; }
        public int test_id { get; set; }
        public string nazv { get; set; }
        public Guid test_token { get; set; }
        public DateTime result_date { get; set; }
        public DateTime result_time { get; set; }
        public int status { get; set; }
        public string iin { get; set; }
        public string fam { get; set; }
        public string im { get; set; }
        public string otc { get; set; }
        public int prav { get; set; }
        public int neprav { get; set; }
        public int ocenka { get; set; }
        public Guid token { get; set; }
        public int ostatok_min { get; set; }
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question