转换数据库值 [英] Convert a databse value
本文介绍了转换数据库值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一张表,其中一个字段是price,数据类型是varchar(50),
我该如何在我的代码中将该值用作整数....
I have a table one field is price and datatype is varchar(50),
how can i use that value as integer in my code....
推荐答案
在asp.net中,您可以使用
In asp.net you can use
Convert.Toint32("varchar value");
或
OR
int.Parse("varchar value");
txtPrice.text=databasePriceValue;
Int intPrice=Convet.Toint32(txtPrice.text)
使用Cast或Convert获取整数值,然后使用
Use Cast or Convert to get the value in interger and then use
SELECT CAST(price AS INT) FROM Table
SELECT CONVERT(INT, price ) FROM Table
这篇关于转换数据库值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文