Re: [問題] ASP.NET
※ 引述《kikolee (kiko)》之銘言:
: : 嗯.........可是B在資料表的設計上是可填null
: : 所以沒有填資料應該視為null填入資料庫不是嗎??
: : 既然可接受null應該不會出錯才是....@@"
: 基本上SQL update的語法為:
: UPDATE table SET column_1 = express_1
: [,column_2 = express_2]
: ... [,column_i = express_i]
: 所以當只有left part 而沒有 right part時,這個語法就是錯的。
: 而且update時不填值,在SQL中不代表就是填入null值喔。
請問一下....在ASP.NET語法上, 要把傳遞給資料庫的值設定成null
要怎麼寫??
例:
<MM:Insert ID="EnglishInsert"
ConnectionString='<%# System.Configuration.ConfigurationSettings.
AppSettings("MM_CONNECTION_STRING_MultipleAuction") %>'
CommandText='<%# "INSERT INTO
English (ProductID,AnnouncePrice,ReservePrice,LimitPrice,ForestalledPrice)
VALUES (?,?,?,?,?)" %>'
CreateDataSet="false"
Debug="true"
Expression='false'
GetRecordCount="false"
IsStoredProcedure="false"
runat="server"
DatabaseType='<%# System.Configuration.ConfigurationSettings.
AppSettings("MM_CONNECTION_DATABASETYPE_MultipleAuction") %>'
>
<Parameters>
<Parameter Name="@ProductID" Value='<%# Session("MaxNowValue") %>'
Type="VarChar" />
<Parameter Name="@AnnouncePrice" Value='<%# IIf((Request.Form
("AnnouncePrice") <> Nothing), Request.Form("AnnouncePrice"), "0") %>'
Type="VarChar" />
<Parameter Name="@ReservePrice" Value='<%# IIf((Request.Form
("ReservePrice") <> Nothing), Request.Form("ReservePrice"), "0") %>'
Type="VarChar" />
<Parameter Name="@LimitPrice" Value='<%# IIf((Request.Form
("LimitPrice") <> Nothing), Request.Form("LimitPrice"), "0") %>'
Type="VarChar" />
<Parameter Name="@ForestalledPrice" Value='<%# IIf((trim(Request.Form
("ForestallPrices")) <> ""), trim(Request.Form("ForestallPrices")), "0") %>'
Type="VarChar" />
</Parameters>
</MM:Insert>
if trim(ForestallPrices.text)="" then
/*將傳至DB的ForestallPrices值設成null*/
Exit Function
CheckData=true
END IF
黃色部分該怎麼寫才對??
謝謝....Orz
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.163.197.102
推
211.78.132.15 05/13, , 1F
211.78.132.15 05/13, 1F
推
218.163.197.102 05/13, , 2F
218.163.197.102 05/13, 2F
→
218.163.197.102 05/13, , 3F
218.163.197.102 05/13, 3F
推
203.73.225.241 05/13, , 4F
203.73.225.241 05/13, 4F
討論串 (同標題文章)
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章