CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  ASP.NET

求救!数值类型的问题啊!

楼主zwq80877(孤独苍狼)2005-05-14 11:09:57 在 .NET技术 / ASP.NET 提问

这是我的添加行的代码,现在我要在t15控制输入的是数字类型,怎么判断啊?但是我用验证控件点击按扭就添加不了内容了,只能用js,但是写了js后怎么在这行调用js  
  <FooterTemplate>  
  <asp:TextBox   id="TextBox6"   runat="server"   Width="50px"   MaxLength="20"></asp:TextBox>  
  </FooterTemplate>  
  这是后台的代码:  
  if   (   e.CommandName   ==   "Insert")  
  {                    
  string   strconn=ConfigurationSettings.AppSettings["zwqiang"];  
  SqlConnection   cn   =   new   SqlConnection(strconn);  
  TextBox   t1   =   (TextBox)e.Item.FindControl("TextBox1");  
  TextBox   t2   =   (TextBox)e.Item.FindControl("TextBox2");  
  TextBox   t3   =   (TextBox)e.Item.FindControl("TextBox3");  
  TextBox   t4   =   (TextBox)e.Item.FindControl("TextBox4");  
  TextBox   t5   =   (TextBox)e.Item.FindControl("TextBox5");  
  TextBox   t6   =   (TextBox)e.Item.FindControl("TextBox6");  
  TextBox   t7   =   (TextBox)e.Item.FindControl("TextBox7");  
  string   t8=t1.Text.Replace("'","''");  
      string   t9=t2.Text.Replace("'","''");  
    stringt10=t3.Text.Replace("'","''");  
    stringt11=t4.Text.Replace("'","''");  
    stringt12=t5.Text.Replace("'","''");  
    stringt13=t6.Text.Replace("'","''");  
    stringt14=t7.Text.Replace("'","''");  
              Decimal             t15=Convert.ToDecimal(t13);  
   
         
      //t8=Convert.ToInt32(t6);  
  //TextBox   t8   =   (TextBox)e.Item.FindControl("TextBox8");  
  //TextBox   t9   =   (TextBox)e.Item.FindControl("TextBox9");  
  cn.Open();  
  string   insert="insert   into   A93STZK(classname,classnumber,name,sex,remark,yilingbookmoney,statuechanger)   values('"   +   t8   +   "','"   +     t9   +"','"   +     t10+"','"   +     t11+"','"   +     t12+"','"+   t15+"','"   +     t14   +   "')";  
   
  SqlCommand   cmd   =   new   SqlCommand(insert,   cn);  
  //SqlCommand   cmd   =   new   SqlCommand("insert   into   A93STZK(classname,classnumber,name,sex,remark,yilingbookmoney,statuechanger)   values('"   +   t1.Text.Replace("'","''")   +   "','"   +     t2.Text.Replace("'","''")   +"','"   +     t3.Text.Replace("'","''")+"','"   +     t4.Text.Replace("'","''")+"','"   +     t5.Text.Replace("'","''")+"','"   +     t6.Text.Replace("'","''")+"','"   +     t7.Text.Replace("'","''")   +   "')",   cn);  
  /*   Response.Write(cmd.CommandText);  
    Response.End();  
  */  
  cmd.ExecuteNonQuery();  
  cn.Close();  
  BindGrid();  
  }  
   
  问题点数:20、回复次数:1Top

1 楼brando_beat(Eの懒龙)回复于 2005-05-14 13:32:26 得分 20

upupTop

相关问题

  • 数值类型问题
  • 数值类型的转换问题
  • 数值类型的转换问题!
  • 数值类型转换问题
  • CString类型转换成数值
  • 有什么办法可以直接将 varchar 类型转换成数值类型?
  • 紧急求救: decimal 类型为什么比 double 类型数值范围小?
  • c++中对于枚举类型数值的操作?
  • DIM AA AS INTEGER 有小数位的数值类型是什么?
  • 数值类型转换问题,(欢迎回帖)

关键词

  • stringt
  • textbox
  • findcontrol
  • replace
  • item
  • text

得分解答快速导航

  • 帖主:zwq80877
  • brando_beat

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo