Let's take a look at this Code:
1 <script language = "JavaScript" type = "text/JavaScript">
2 <! --
3 For (VAR I = 0; I <= 9; I ++)
4 {
5 Document. writeln ('<input type = "radio" name = "face" value = "' + I + '"' + (I = 2? 'Checked': '') + '/> ' + '& nbsp; & nbsp ;');
6 (I = 4) document. writeln ("<br/> ");
7}
8 -->
9 </SCRIPT>
10
It is used to implement the expression number.
Obtain the emoticon number in the background:
1 protected void sqldatasource1_inserting (Object sender, sqldatasourcecommandeventargs E)
2 {
3 E. Command. Parameters. Add (New sqlparameter ("@ face", convert. todecimal (request. Form ["face"]. tostring ())));
4 E. Command. Parameters. Add (New sqlparameter ("@ posttime", system. datetime. Now. tostring ()));
5}
You must know that the face field type in the database is int.
In this way, the conversion is successful.
However, convert. toint32 (request. Form ["face"]. tostring () will prompt that ntext and INT conversion is incorrect.
The original request. Form ["face"]. tostring () is of the ntext type. I am dizzy ....
I checked the information online:
In MSSQL, Enterprise Manager cannot directly convert text or ntext data to int type, which sometimes causes inconvenience.
In fact, a simple method can be used to convert text data to int type.
First, convert both text and ntext data to nvarchar,
Then convert nvarchar to int.
The same is true for decimal conversion.
Http://www.topfisher.com/phpbbs/simple/index.php? T28.html