mattn / go-adodb

Microsoft ActiveX Object DataBase driver for go that using exp/sql
http://mattn.kaoriya.net/
MIT License
142 stars 36 forks source link

sql: expected 0 arguments, got 173 #46

Closed genesioliniantares closed 4 years ago

genesioliniantares commented 5 years ago

Hello, I am trying to insert some records into an Access database (MDB format)

I have a fixed string that I am using as insert statement and then I provide the 173 parameters in the params slice

insertStmt is a StringBuilder and destDb is a *sqlx.Db

res, err := destDb.Exec(insertStmt.String(), params...) log.Println(res)

Unfortunately I have not been able to run the command, it looks like the library does not understand I want 173 parameters passed with the question mark placeholder

INSERT INTO ARCHIVIO ([Codice],[Tel],[Data],[ATTIVA],[RagSoc],[Sede],[Cap1],[Città1],[Pr1],[DomFis],[Cap2],[Città2],[Pr2],[CON FIS],[COD FIS],[P IVA],[COD ATT],[NAT GIUR],[DATA COST],[DATA CESS],[REG IMP],[REA],[AIA],[REC],[MECC EXP],[INAIL],[INPS],[CAPE],[AUT APPREN],[CAP SOC],[SOGG 626],[RESPONSABILE],[USSL],[UFF IMPOSTE],[BANCA CLI],[C/C],[MOD P],[BANCA PRAGMA],[SOCIO1],[CF1],[QUOTA1],[NATOA1],[IL1],[LAV1 SI/NO],[RES1],[CP1],[CITT1],[PRO1],[SOCIO2],[CF2],[QUOTA2],[NATOA2],[IL2],[LAV2 SI/NO],[RES2],[CP2],[CITT2],[PRO2],[SOCIO3],[CF3],[QUOTA3],[NATOA3],[IL3],[LAV3 SI/NO],[RES3],[CP3],[CITT3],[PRO3],[SOCIO4],[CF4],[QUOTA4],[NATOA4],[IL4],[LAV4 SI/NO],[RES4],[CP4],[CITT4],[PR4],[SOCIO5],[CF5],[QUOTA5],[NATOA5],[IL5],[LAV5 SI/NO],[RES5],[CP5],[CITT5],[PR5],[LEGALE RAPPRESENT],[POTERI FIRMA],[OGGETTO],[NOTE],[NOTE1],[NOTE2],[NOTE3],[IMU],[DR],[770],[PAGHE],[PAGHE LIGHT],[CONTRATTO],[DATA FATTURA],[IMPORTO FATTURA],[VALUTA BONIFICO],[SOCIETA' ASSITENTE],[RAPPRES LAVORATORI],[MEDICO COMPETENTE],[SERVIZIO PREVENZIONE],[CONAI],[MAIL],[MAIL CERTIFICATA],[CELLULARE],[PERSONA RIFERIMENTO],[UTENTE ID PL],[PASSWORD PL],[FAX],[REGIONE],[STUDIO COLLEGATO],[SCADENZA CONTRATTO],[RESPONSABILE CED],[CED ENTRO IL],[DIP],[CONTABILITA'],[CONSUL CONTAB],[CONTABILITA LIGHT],[CONTABILITA SEMPL],[CONTABILITA ORDIN],[RESPONSABILE CONTABILITA],[IMPORTO SEMPL MENSILE],[IMPORTO ORDIN MENSILE],[IMPORTO CED PAGA],[CANONE ANNUO CIRCOLAR],[ISCRIZIONE ENTI],[UNILAV ASS CESS TRASF],[UNILAV PARTICOLARI],[ISCRIZ ENTI BILATERALI],[CESSAZIONE POS ENTI],[DENUNCIA CIG A DIP],[DENUNCIA INFORTUNIO],[CONTRATTI A PROGETTO],[RICHIESTA DURC],[F24 A RATA],[F24 COMPENSAZ EXTRA PAGHE],[CALCOLO NETTO LORDO DIP],[RAVVEDIMENTO OPEROSO],[INSERIMENTO 730],[INSERIMENTO ASS FAMILIARI],[DICHIARAZIONE UFFICIO MIRATO],[CONSUL EXTRA ELAB IMP OR],[PRES DICH SALARI INAIL],[IMPORTO CUD],[CON SEMPL ANNUALE],[CON ORDIN ANNUALE],[PRES E MENS],[ASSUNZIONI DIMISSIONI],[TIROCINIO ISTRUTTORIA ED ASUNZIONE],[LETTERE COMUNICAZIONI PARTICOLARI],[ALTRI PATTI],[STUDIO DI FATTURAZIONE],[Cod esportazione movimenti],[Codice cliente Parce],[INSEGNA],[UL],[FATT AUT PL],[FATTAUT CL],[DATA FINE SERVIZI],[UNI],[SCADENZA FIRMA DIGITALE],[FIRMA1],[FIRMA2],[FIRMA3],[FIRMA4],[FIRMA5]) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

iwc-james commented 4 years ago

Hello, same here. In "go-adodb/_example/mdb.go" I can create an accdb file and create a foo table. Inserting and selecting requests don't work with variable substition (?, @test or :test) giving 0 arguments expected. Thanks for help

Version info : go version go1.13.4 windows/amd64

James

YamiOdymel commented 4 years ago

the same error occurred with the mdb.go example.

exec sql: expected 0 arguments, got 3
stmt, err := tx.Prepare("insert into foo(id, name, created) values(?, ?, ?)")
if err != nil {
    fmt.Println("insert", err)
    return
}
defer stmt.Close()

for i := 0; i < 1000; i++ {
    _, err = stmt.Exec(i, fmt.Sprintf("こんにちわ世界%03d", i), time.Now())
    if err != nil {
        fmt.Println("exec", err)
        return
    }
}
tx.Commit()
The program is running with set GOARCH=386
go version go1.12.8 windows/amd64