我尝试将日期库中的文本框数据发送到表中 [英] i am tryieng to send textbox data to the table in date base

查看:66
本文介绍了我尝试将日期库中的文本框数据发送到表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将日期库中的文本框数据发送到表格中,显示错误,这样plz帮助我..



转换varchar值时转换失败' System.Web.UI.WebControls.TextBox'到数据类型int。

i am tryieng to send textbox data to the table in date base its showing error like this plz help me..

Conversion failed when converting the varchar value 'System.Web.UI.WebControls.TextBox' to data type int.

推荐答案

实际上TextBox值是默认的字符串(varchar for sql),以及数据库中的列期望int值。所以它抛出了这个错误。你需要将这个值强制转换为int。



Actually TextBox value are string by default (varchar for sql), and the column in database expects int value. So its throwing this error. YOu need to typecast this value to int.

int a = like Convert.ToInt32(textbox1.Text)





比使用这个值传递给数据库。



than use this value to pass to database.


这篇关于我尝试将日期库中的文本框数据发送到表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆