标题:[求助]INSERT 问题
取消只看楼主
fandgg
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-3-26
 问题点数:0 回复次数:1 
[求助]INSERT 问题

string strtitle = this.txttitle.Text.Trim(); //为textbox 表里为varchar
string strprice = this.txtprice.Text.Trim(); //为textbox 表里为money
string connstr = ("database=pubs;uid=sa;pwd=;server=.;");
SqlConnection conn = new SqlConnection(connstr);
string comm = "insert into titles(title,price,title_id,title) values ('"+strtitle+"','"+strprice+"',3212,3000)";
SqlCommand command = new SqlCommand(comm,conn);
conn.Open();
command.ExecuteNonQuery();
conn.Close();

this.BindToGrid();

“/rr1”应用程序中的服务器错误。
--------------------------------------------------------------------------------

不允许从数据类型 varchar 到数据类型 money 的隐性转换(表 'pubs.dbo.titles',列 'price')。请使用 CONVERT 函数来运行此查询。

搜索更多相关主题的帖子: INSERT 
2007-09-11 18:40
fandgg
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-3-26
得分:0 

在线等啊。。。。

2007-09-11 18:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-169225-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.303425 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved