sql: unknown driver "sqlite3" (forgotten import?) 求大神帮忙!

cloa · · 5032 次点击
代码贴出来看看啊
#1
更多评论
代码贴出来看看啊
#2
package main import ( "database/sql" "fmt" "log" _ "github.com/mattn/go-sqlite3" ) func main() { db, err := sql.Open("sqlite3", "./test.db") if err != nil { log.Fatal(err) } defer db.Close() var count int if err := db.QueryRow("select count(*) count from test where id=1").Scan(&count); err != nil { fmt.Println("Failed to QueryRow:", err) } fmt.Println(count) }
#3