Thank you so much for your response!

The code you added probably works, but I'm getting held up by something 
else.

I'm running into a set of errors when I execute this on the command 
line...It seems the "rows" value I'm creating doesn't have the 
functionality that the guide says it would????

# command-line-arguments
./2multi.go:22: rows.Columns undefined (type error has no field or method 
Columns)
./2multi.go:30: rows.Next undefined (type error has no field or method Next)
./2multi.go:34: rows.Scan undefined (type error has no field or method Scan)
Here's an updated version of my code

package main

import (
       "database/sql"
       "fmt"
       "log"

        _ "github.com/go-sql-driver/mysql"
)

func main() {
//Connect to database and check for errors  
       db, err := sql.Open("mysql",
               "script:script1!@tcp(10.14.0.173:3306)/dbaTesting")
       if err != nil {
               log.Println(err)
       }

        var str string
       rows := db.QueryRow("SELECT * FROM animals").Scan(&str)

        cols, err := rows.Columns() // Remember to check err afterwards
       if err != nil {
               log.Fatal(err)
       }

        vals := make([]interface{}, len(cols))


        for rows.Next() {
       for i := range cols {
           vals[i] = &vals[i]
               }
       err = rows.Scan(vals...)
       // Now you can check each element of vals for nil-ness,
       if err != nil {
               log.Fatal(err)
       }
       for i := range cols {
                   fmt.Println(vals[i]) 
                }
       }
}


Shouldn't the value I create in "rows" be able to pass arguments to the 
"db" class I'm referencing when I'm creating "rows?"

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to