求教!--~怎么在C#.Net 下给 money 型的数据库表列赋值啊??
我在 Sql Server 2000 建立了一个表 ware,其中有个 price 列是 money 类型的,现在我想从 表单的 txtPrice.Text 读取输入的值并付给这个Price 列,怎么写啊??Covert不能转化成money型,用(money)txtPrice.Text 提示 找不到命名空间 money。
无论在 WinForm 还是 WebForm 都不行。。。
求教啊!!跪求~~
另外,要想在WebForm 使用MessageBox,有没有可能?怎么不能 using System.Windows.Forms 啊??
是不是要嵌入 VBScript 的MsgBox ?是在后台嵌入吗?
谢谢!!!
问题点数:30、回复次数:4Top
1 楼Merlin_Bloom(Alex)回复于 2006-03-21 01:15:52 得分 0
给 Price 赋 int 值。。。Top
2 楼Merlin_Bloom(Alex)回复于 2006-03-21 01:34:01 得分 0
Convert.UInt(txtPrice.Text);Top
3 楼championchen79(现学现卖)回复于 2006-03-21 08:53:23 得分 15
1.使用cast转换,注意cast是sql的转换类型。
INSERT INTO TestMoney VALUES (3, CAST('$444,123.45' AS MONEY) )
2.不能使用messagebox,可以使用javascript的alert或者window.open()
Top
4 楼xxbbww(黑月光)回复于 2006-03-21 09:37:18 得分 15
写sql语句的时候使用参数,之后加上
SqlParameter Price= new SqlParameter("@Price",SqlDbType.money,8,"Price");
Price.value = txtPrice.Text;Top




