在購買物品時,需要對客戶賬戶上的餘額與物品的實際**進行比較,因此需要把sql中的money讀取出來,並進行轉化。
找了好久。
結果如下
string
st1=
configurationmanager.connectionstrings[
"yikawangluoconnectionstring
"].connectionstring;
sqlconnectionconn1
=new
sqlconnection(st1);
conn1.open();
sqlcommandmycomm1
=new
sqlcommand(
"selectaccountfromuserinfowherename='"+
name2+"
'",conn1);
try...
catch
(sqlexceptioneeee)
...
在檢索的過程中,有如下答案,採用了第一種。
資料庫中的money型別對應c#的decimal型別,要解決這個問題起碼有兩種辦法轉換資料型別:
1: 使用convert類提供的靜態方法todecimal
decimalmoney= convert.todecimal(this.lable1.text.trim());
2: 使用decimal類提供的靜態方法parse
decimalmoney= decimal.parse(this.lable1.text.trim());
Python將json轉化為sql語句
呼叫阿里雲資料庫監控資料返回的json資料 案例資料 apidate key mysql detailedspaceusage unit mb valueformat ins size data size log size tmp size other size key mysql iops uni...
C 將DataTable轉化為List
c 將datatable轉化為list 在使用三層架構開發乙個 時,希望把datatable物件轉換為list物件,於是在網上找資料,總結乙個比較方便的方法來實現 使用反射。思路 初始化乙個list物件 獲取到t所有的屬性,初始化乙個t物件 遍歷所有屬性,如果datatable中含有相應屬性的值則為...
sql 將字串轉化為table
引數說明 第乙個引數為要轉化的字串,第二個引數為字串中間的分隔符 create function func split hongfei0416j sourcesql varchar 8000 strseprate varchar 2 returns temp table col varchar 10...