将varchar值'-9.9'转换为数据类型为int的列时发生语法错误

che2piaopiao 2010-09-13 09:18:23
会员登录时报这个报误。

现在程序加密了,没法动。 是否可以通过修改数据库字段类型来解决。



请教大家有什么好的解决方法吗。
...全文
90 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
che2piaopiao 2010-09-14
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 wuyq11 的回复:]
userLoginCount 需要使用Math.Round?
跟踪SQL语句,在查询分析器执行
[/Quote]

没法根踪。。
che2piaopiao 2010-09-14
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 bclz_vs 的回复:]
修改数据库的字段类型为int
[/Quote]

原来就是INT。

谢谢。
libolei 2010-09-14
  • 打赏
  • 举报
回复
涉及到的所有表的每列 查查看哪列有 -9.9
你这什么都不能弄
只能用笨办法了
che2piaopiao 2010-09-13
  • 打赏
  • 举报
回复
把代码反编了一下。。

还是没有找出问题所在。。

  private void login(string userid, string password)
{
if ((Strings.Trim(userid).Length <= 0) & (Strings.Trim(password).Length > 0))
{
ClassShared.aspShowMessagebox("用户名和密码不能为空!", "-1", false);
}
else
{
string sql = "select top 1 * from sys_user where userid=@v0";
SqlConnection cN = null;
DataSet set = base.mZSF.GetDataSet(sql, new SqlDbType[] { SqlDbType.NVarChar }, new string[] { userid }, ref cN, 0, 0, "@V");
if (set.Tables[0].Rows.Count <= 0)
{
ClassShared.aspShowMessagebox("用户名不存在!", "-1", false);
}
else if (!ClassPwd.encryptBIZpassword(password).Equals(Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["password"]))))
{
ClassShared.aspShowMessagebox("密码不正确!", "-1", false);
}
else
{
int num = (int) Math.Round(Conversion.Val(Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["id"]))));
ClassUser.userLoginCount = (int) Math.Round((double) (Conversion.Val(Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["logincount"]))) + 1.0));
sql = ("update sys_user set last_login=CURRENT_TIMESTAMP,logincount=" + ClassUser.userLoginCount.ToString()) + " where id=" + Conversions.ToString(num);
cN = null;
base.mZSF.ExecuteCommand(sql, null, null, ref cN, "@V");
string expression = Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["pagelast"]));
if (Information.IsDate(expression))
{
ClassUser.currentUserTemplatePageLast = Conversions.ToDate(expression);
}
else
{
ClassUser.currentUserTemplatePageLast = DateAndTime.Now.AddYears(-1);
}
ClassUser.userFlag = ClassUser.convertUserGradeToType(Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["grade"])));
ClassUser.currentMemberLevel = (int) Math.Round(Conversion.Val(Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["mlevel"]))));
ClassUser.currentUserid = Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["userid"]));
ClassUser.currentUserNumericID = num;
ClassUser.lastLoginTime = Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["last_login"]));
ClassUser.registerTime = Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["first_login"]));
ClassUser.currentuserMSNID = Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["msnid"]));
this.Response.Redirect("default.aspx");
}
}
}


大家看看哦。。
che2piaopiao 2010-09-13
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 porschev 的回复:]
不能改程序?

那你把这个字段的-9.9改掉吧。。。
[/Quote]


查看用户表,,没发现9.9 哇。。郁闷。
porschev 2010-09-13
  • 打赏
  • 举报
回复
不能改程序?

那你把这个字段的-9.9改掉吧。。。
wuyq11 2010-09-13
  • 打赏
  • 举报
回复
userLoginCount 需要使用Math.Round?
跟踪SQL语句,在查询分析器执行
边城的刀声 2010-09-13
  • 打赏
  • 举报
回复
修改数据库的字段类型为int
che2piaopiao 2010-09-13
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 wang2129929 的回复:]
真长, 我看不了,, 你调试下吧。 看看-9.9哪出来的
[/Quote]

关键是现在没法调试。。
che2piaopiao 2010-09-13
  • 打赏
  • 举报
回复
回6楼,, 我也这么觉得。 我想直接可以屏蔽掉了。




我现在正在想法用

ILDASM反编译和ILASM重编译

整理呢

谁会用IL 的,,教教我。。
阿双2009 2010-09-13
  • 打赏
  • 举报
回复
int num = (int) Math.Round(Conversion.Val(Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["id"]))));

ClassUser.userLoginCount = (int) Math.Round((double) (Conversion.Val(Convert.ToString(RuntimeHelpers.GetObjectValue(set.Tables[0].Rows[0]["logincount"]))) + 1.0));

问题应该出在这两句
Peter200694013 2010-09-13
  • 打赏
  • 举报
回复
-9.9? 程序哪里?
  • 打赏
  • 举报
回复
真长, 我看不了,, 你调试下吧。 看看-9.9哪出来的

17,740

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧