go语言 panic: sql: expected 10 destination arguments in Scan, not 2

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返回的字段个数一致,否则会报错"

 

吐了。。。

上一篇:简约之美Jodd-http--深入源码理解http协议


下一篇:[LeetCode] 505. The Maze II