本人初学ASP.net
在ASP连接数据库时取numeric值时想把它在页面显示出来,因此想把它转化为string类型,但是运行时老显示错误信息:无法将类型为“System.Decimal”的对象强制转换为类型“System.String”。
排错提示:
当从一个数字强行转化时,值必须是一个小于无限大的数字;
确保源类型可以转化为目标类型
请问各位该怎么解决?
如果取int类型呢?
在线等..........谢谢
在ASP连接数据库时取numeric值时想把它在页面显示出来,因此想把它转化为string类型,但是运行时老显示错误信息:无法将类型为“System.Decimal”的对象强制转换为类型“System.String”。
排错提示:
当从一个数字强行转化时,值必须是一个小于无限大的数字;
确保源类型可以转化为目标类型
请问各位该怎么解决?
如果取int类型呢?
在线等..........谢谢
我上边的连接过程是:
SqlConnection Conn;
Conn = new SqlConnection("server=localhost;database=school;uid=sa;pwd=");
Conn.Open();
SqlCommand com =new SqlCommand ();
com.Connection = Conn;
com.CommandText = "select * from score ";
SqlDataReader data= com.ExecuteReader();
while (data.Read()) {
data.........哪个方法呢?