SQLサーバーにデータベースがあります。私が質問しなければならないテーブルは次のとおりです:それは4つの列を持っています:(テーブル名:投票)
idbigintnotnull主キー
optAvotesbigintnotnull optBvotes bigint notnull
optCvotes bigint notnull加算
、パーセンテージ計算など、これらの列の値に対して数学演算を実行したい。次のように実行しています。
dim da as new sqldataadapter("select * from votes",con)
dim ds as new dataset
da.fill(ds)
dim A,B,C,Total as integer
A=ds.tables(0).rows(0).item("optAvotes").tostring
B=ds.tables(0).rows(0).item("optBvotes").tostring
C=ds.tables(0).rows(0).item("optCvotes").tostring
Total=A+B+C
Totalの値を表示すると、文字列からの変換であるエラーが表示されます。 一方、これらの変数を文字列として宣言すると、Total = A + B + Cは結果を連結文字列として表示します。したがって、できるだけ早く解決策を教えてください。 。