代码如下
每次提示:INSERT INTO 语句的语法错误。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。 ........
OleDbConnection myconn= new OleDbConnection(ConnString);
OleDbDataAdapter mycommand=new OleDbDataAdapter("Select user,email,password,hellacah from m_tacle where user='"+user.Text+"'", myconn);
DataSet ds=new DataSet();
mycommand.Fill(ds,"m_tacle");
DataTable table=ds.Tables["m_tacle"];
DataRow dr=ds.Tables["m_tacle"].NewRow();
dr[0]=username.Text.ToString();
dr[1]=password.Text.ToString();
dr[2]=email.Text.ToString();
table.Rows.Add(dr);
mycommand.InsertCommand=new OleDbCommand("insert into m_tacle(user,password,email) values('"+dr[0]+"','"+dr[1]+"'','"+dr[2]+"')",oleConn);
OleDbCommandBuilder objCommandBuilder =new OleDbCommandBuilder(mycommand);
mycommand.Update(ds,"m_tacle");
每次提示:INSERT INTO 语句的语法错误。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。 ........
OleDbConnection myconn= new OleDbConnection(ConnString);
OleDbDataAdapter mycommand=new OleDbDataAdapter("Select user,email,password,hellacah from m_tacle where user='"+user.Text+"'", myconn);
DataSet ds=new DataSet();
mycommand.Fill(ds,"m_tacle");
DataTable table=ds.Tables["m_tacle"];
DataRow dr=ds.Tables["m_tacle"].NewRow();
dr[0]=username.Text.ToString();
dr[1]=password.Text.ToString();
dr[2]=email.Text.ToString();
table.Rows.Add(dr);
mycommand.InsertCommand=new OleDbCommand("insert into m_tacle(user,password,email) values('"+dr[0]+"','"+dr[1]+"'','"+dr[2]+"')",oleConn);
OleDbCommandBuilder objCommandBuilder =new OleDbCommandBuilder(mycommand);
mycommand.Update(ds,"m_tacle");
解决方案 »
- Fckeditor保存上传文件的路径问题!很急!!!!
- 加急!在线等!解决立马给分!我自己的网站在本机运行没问题,但是放到服务器上就无法打开报错误!
- 一个数据字段存多个值,并遍历取出C# .net
- 统计下载数量???
- 求教:请问什么是静态html页面?如何建立一个静态html页面
- 上次做了个论坛,大家提了很多宝贵的意思,吸取上次经验,又重新做了一个还是基于三层的,麻烦大家指正!
- 为什么在ListBox绑定数据库后就没有办法在两个ListBox中传递选中项?
- 小妹急需.net进销存系统的源码,请各位大哥帮帮忙吧
- 我怎么獲得當前頁面上得所有得textbox,dropdownlist等控件?
- 我也来凑个热闹,Oracle下500万记录分页(含思路)
- 抢分啦抢分啦,新手提问.
- 求救!!数据库INSERT出错,给指点一下!!!
--引号用的有问题
修改成了这样还是不行还是提示INSERT INTO 语句的语法错误。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。
OleDbDataAdapter mycommand=new OleDbDataAdapter("Select user,email,password,hellacah from m_tacle where user='"+user.Text+"'", myconn);
DataSet ds=new DataSet();
mycommand.Fill(ds,"m_tacle");
DataTable table=ds.Tables["m_tacle"];
DataRow dr=ds.Tables["m_tacle"].NewRow();dr.ItemArray[0]=username.Text.ToString();//modified
dr.ItemArray[1]=password.Text.ToString();//modified
dr.ItemArray[2]=email.Text.ToString();//modifiedtable.Rows.Add(dr);mycommand.InsertCommand=new OleDbCommand("insert into m_tacle(user,password,email) values('"+dr.ItemArray[0].ToString()+"','"+dr.ItemArray[1].ToString()+"','"+dr.ItemArray[2].ToString()+"')",oleConn);//modifiedOleDbCommandBuilder objCommandBuilder =new OleDbCommandBuilder(mycommand);
mycommand.Update(ds,"m_tacle");
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。源错误:
行 181: mycommand.InsertCommand=new OleDbCommand("insert into m_tacle(user,password,email) values('"+dr[0]+"','"+dr[1]+"','"+dr[2]+"')",oleConn);
mycommand.InsertCommand=new OleDbCommand("insert into m_tacle(user,password,email) values("+dr[0]+","+dr[1]+","+dr[2]+")",oleConn);
这2个都试验了...
行 182:OleDbCommandBuilder objCommandBuilder =new OleDbCommandBuilder(mycommand);
行 183: mycommand.Update(ds,"m_tacle");<--红色显示这里
用了你这个方法还是提示错误奇怪了...
然后复制到ORACLE查询分析器里,去掉前后的引号,执行语句就知道错误在什么地方了
复制到SQL查询分析器中执行
使用了你的方法调试
用label1输出insert语句..
发现赋值不了
insert into m_tacle(user,password,email) values('','','')
action
add
aggregate
all
alter
after
and
as
asc
avg
avg_row_length
auto_increment
between
bigint
bit
binary
blob
bool
both
by
cascade
case
char
character
change
check
checksum
column
columns
comment
constraint
create
cross
current_date
current_time
current_timestamp
data
database
databases
date
datetime
day
day_hour
day_minute
day_second
dayofmonth
dayofweek
dayofyear
dec
decimal
default
delayed
delay_key_write
delete
desc
describe
distinct
distinctrow
double
drop
end
else
escape
escaped
enclosed
enum
explain
exists
fields
file
first
float
float4
float8
flush
foreign
from
for
full
function
global
grant
grants
group
having
heap
high_priority
hour
hour_minute
hour_second
hosts
identified
ignore
in
index
infile
inner
insert
insert_id
int
integer
interval
int1
int2
int3
int4
int8
into
if
is
isam
join
key
keys
kill
last_insert_id
leading
left
length
like
lines
limit
load
local
lock
logs
long
longblob
longtext
low_priority
max
max_rows
match
mediumblob
mediumtext
mediumint
middleint
min_rows
minute
minute_second
modify
month
monthname
myisam
natural
numeric
no
not
null
on
optimize
option
optionally
or
order
outer
outfile
pack_keys
partial
password
precision
primary
procedure
process
processlist
privileges
read
real
references
reload
regexp
rename
replace
restrict
returns
revoke
rlike
row
rows
second
select
set
show
shutdown
smallint
soname
sql_big_tables
sql_big_selects
sql_low_priority_updates
sql_log_off
sql_log_update
sql_select_limit
sql_small_result
sql_big_result
sql_warnings
straight_join
starting
status
string
table
tables
temporary
terminated
text
then
time
timestamp
tinyblob
tinytext
tinyint
trailing
to
type
use
using
unique
unlock
unsigned
update
usage
values
varchar
variables
varying
varbinary
with
write
when
where
year
year_month
zerofill