Skip to content

Possibly too many arguments? #88

Closed
@khmseu

Description

@khmseu

Output snippet:

private const string InsertRecordSql = "INSERT INTO importer.export ( fxtel , fxadr, fxname, fxres1, fxres2, fxanw, fxmand, fxdatei, fxusr1, fxusr2, fxname2, fxstr, fxplz, fxort, fxasp, fxzus, fxemail, fxprio, fxextra ) VALUES ( @tel, @adr, @name, @res1, @res2, @anw, @mand, @datei, @usr1, **@tel0, @tel1, @tel2, @tel3, @tel4, @tel5, @tel6, @tel7, @tel8, @tel9** ) "; 
    public readonly record struct InsertRecordArgs(string? Tel, string? Adr, string? Name, string? Res1, string? Res2, string? Anw, string? Mand, string? Datei, string? Usr1, string? Usr2, string? Name2, string? Str, string? Plz, string? Ort, string? Asp, string? Zus, string? Email, string? Prio, object? Extra);
    public async Task InsertRecord(InsertRecordArgs args)
    {
        {
            await using var connection = NpgsqlDataSource.Create(connectionString);
            await using var command = connection.CreateCommand(InsertRecordSql);
            command.Parameters.AddWithValue("@tel", args.Tel);
            command.Parameters.AddWithValue("@adr", args.Adr);
            command.Parameters.AddWithValue("@name", args.Name);
            command.Parameters.AddWithValue("@res1", args.Res1);
            command.Parameters.AddWithValue("@res2", args.Res2);
            command.Parameters.AddWithValue("@anw", args.Anw);
            command.Parameters.AddWithValue("@mand", args.Mand);
            command.Parameters.AddWithValue("@datei", args.Datei);
            command.Parameters.AddWithValue("@usr1", args.Usr1);
            command.Parameters.AddWithValue("@usr2", args.Usr2);
            command.Parameters.AddWithValue("@name2", args.Name2);
            command.Parameters.AddWithValue("@str", args.Str);
            command.Parameters.AddWithValue("@plz", args.Plz);
            command.Parameters.AddWithValue("@ort", args.Ort);
            command.Parameters.AddWithValue("@asp", args.Asp);
            command.Parameters.AddWithValue("@zus", args.Zus);
            command.Parameters.AddWithValue("@email", args.Email);
            command.Parameters.AddWithValue("@prio", args.Prio);
            command.Parameters.AddWithValue("@extra", args.Extra);
            await command.ExecuteScalarAsync();
        }
    }

InsertRecordSql has wrong argument names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions