求救!数值类型的问题啊!
这是我的添加行的代码,现在我要在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




