You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So this works perfectly for most queries with Tally but for certain fields I get this error wrong column #0 length 0 returned, 8 expected. Same code works for say SELECT $Name FROM StockItem and the query that causes errors here works fine with PyODBC. Any idea what I can do for this? The value of the field when extracted through PyODBC is a string of the form Price/Unit for example 99.00/nos
import (
"database/sql"
"fmt"
"log"
)
func ReadProducts(db *sql.DB) {
rows, err := db.Query("SELECT $StandardPrice FROM StockItem")
if err != nil {
log.Fatal("Failed to execute query:", err)
}
defer rows.Close()
for rows.Next() {
var stockItemName sql.NullString
err := rows.Scan(&stockItemName)
if err != nil {
log.Fatal("Failed to scan row:", err)
}
fmt.Printf("Stock Item Name: %s\n", stockItemName.String)
}
if err = rows.Err(); err != nil {
log.Fatal("Error occurred during row iteration:", err)
}
}
I used this driver to connect to MS SQL Server. Never to TallyODBC64_9000 . Maybe you can adjust the code so it works with TallyODBC64_9000 .
Alex
Yeah, fair. I was considering it already actually but I wanted to see if you have any idea of what it could be first. Also I just realized I forgot to change some of the variable names. I was playing around with the fields a bit to see what was causing the issue haha
So this works perfectly for most queries with Tally but for certain fields I get this error
wrong column #0 length 0 returned, 8 expected
. Same code works for saySELECT $Name FROM StockItem
and the query that causes errors here works fine with PyODBC. Any idea what I can do for this? The value of the field when extracted through PyODBC is a string of the formPrice/Unit
for example99.00/nos
Code for the connection
The text was updated successfully, but these errors were encountered: