实在搞不明白问题

losting 2003-04-12 06:41:46
各位:
   我的SQL在Windows下执行一点问题都没有,但到WEB执行却说:语法错误或
访问受限,真不明白:
以下是代码:
ls_sql="update dba.custom_contact ";
ls_sql=ls_sql+ "set remark=\'"+TEXTAREA1.Value.ToString()+"\' ";
ls_sql=ls_sql+" where custno=\'"+this.cs_custno+"\'";
System.Data.OleDb.OleDbCommand updatecmd= new
try
{
System.Data.OleDb.OleDbCommand(ls_sql,this.oleDbConnection1);
this.oleDbConnection1.Open();
if (updatecmd.ExecuteNonQuery()>0)
{ this.msg_box("udpate successfully");}
}
catch (System.Exception e)
{
this.msg_box(ls_sql);
this.msg_box("数据存盘出错,请与系统管理员联络!"+e.Message);
}
...全文
34 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
losting 2003-04-14
  • 打赏
  • 举报
回复
Many thanks for saucer's kind answer , I'm sure my SQL statement is correct. the
main problem may that my database is Sybase ASA7.03 , it's may not very get
well with oledb in .net platform. I gave up oledb connection and changed to
ODBC, it's looks working.

Thanks for all again.
saucer 2003-04-14
  • 打赏
  • 举报
回复
write out the sql statement, run it manually in the query tool for your database to make sure it works

Response.Write("****" + ls_sql+"***<BR>");

if you are using Access, make sure you give ASPNET account write permissions on the database file and the directory it is in
losting 2003-04-13
  • 打赏
  • 举报
回复
不好意思,写错了,代码应如comy(泥娃)所示, 语法本身没问题,就是不明是什么问题!
comy 2003-04-13
  • 打赏
  • 举报
回复
ls_sql="update dba.custom_contact ";
ls_sql=ls_sql+ "set remark=\'"+TEXTAREA1.Value.ToString()+"\' ";
ls_sql=ls_sql+" where custno=\'"+this.cs_custno+"\'";
try
{
System.Data.OleDb.OleDbCommand updatecmd= new
System.Data.OleDb.OleDbCommand(ls_sql,this.oleDbConnection1);
this.oleDbConnection1.Open();
if (updatecmd.ExecuteNonQuery()>0)
{ this.msg_box("udpate successfully");}
}
catch (System.Exception e)
{
this.msg_box(ls_sql);
this.msg_box("数据存盘出错,请与系统管理员联络!"+e.Message);
}

62,025

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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