https://blog.csdn.net/westhod/article/details/80799266
db,err := sql.Open("mysql","root:root@/forge") if err != nil { panic(err) } rows,err := db.Query("select id,name from sy_staff") for rows.Next() { var id int var name string err = rows.Scan(&id,&name) fmt.Println(id) fmt.Println(name) }
"在rows.Scan时,传入的参数个数必须与SELECT返回的字段个数一致,否则会报错"
吐了。。。