| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 849 人关注过本帖
标题:大虾帮帮忙,
只看楼主 加入收藏
hexuelu1029
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-6-4
收藏
 问题点数:0 回复次数:2 
大虾帮帮忙,
这是错误信息INSERT INTO 语句的语法错误。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。

Source Error:


Line 71:             OleDbCommand mycommand = new OleDbCommand(aaa,myconnection);
Line 72:             mycommand.Connection.Open();
Line 73:             mycommand.ExecuteNonQuery();
Line 74:             mycommand.Connection.Close();
Line 75:             Response.Write("<script language=Javascript>alert('注册成功')</script>");

下面是原代码

往ACCESS添加数据
string aaa="insert into zhuce(a_name,a_pwd,a_apwd,a_e-mail,a_tel) values('"+TextBox1.Text+",'"+TextBox2.Text+"','"+TextBox3.Text+"','"+TextBox4.Text+"','"+TextBox5.Text+"')";
            OleDbConnection myconnection  = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("db1.mdb"));
            OleDbCommand mycommand = new OleDbCommand(aaa,myconnection);
            mycommand.Connection.Open();
            mycommand.ExecuteNonQuery();
            mycommand.Connection.Close();
            Response.Write("<script language=Javascript>alert('注册成功')</script>");

请高手帮帮吧,谢啦,
Q:153739793
搜索更多相关主题的帖子: web Line mycommand INSERT 
2008-06-04 14:16
Southstar
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2008-6-4
收藏
得分:0 
你最好try,catch一下
应该是数据库的连接问题
2008-06-04 14:32
wuhui5201717
Rank: 1
来 自:湖南省郴州市桂阳县
等 级:新手上路
帖 子:42
专家分:0
注 册:2008-5-9
收藏
得分:0 
('"+TextBox1.Text+",'"+TextBox2.Text+"','"+TextBox3.Text+"','"+TextBox4.Text+"','"+TextBox5.Text+"')";
这有误,好像第一个TextBox1.Text右边少了个 ‘ 号
2008-06-04 14:40
快速回复:大虾帮帮忙,
数据加载中...
 
   



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

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