BBS水木清华站∶精华区
发信人: Sailors (GiGi), 信区: Java
我用insert命令,形式如下:
insert into tablename values(***)
当"***"是具体的数时,可以成功地写入,但当"***"为已经赋值的变量名时,却出错,
我把语句改成 insert into tablename from array arrayname,也不行,这可是msdn上
指明的方法呀,为什么,为什么,好郁闷的说.
发信人: realchick (小鸡), 信区: Java
【 在 Sailors (GiGi) 的大作中提到: 】
∶ 我用insert命令,形式如下:
∶ insert into tablename values(***)
∶ 当"***"是具体的数时,可以成功地写入,但当"***"为已经赋值的变量名时,却出错,
∶ 我把语句改成 insert into tablename from array arrayname,也不行,这可是msdn上
∶ 指明的方法呀,为什么,为什么,好郁闷的说
不是要用string的吗?
不能把变量放在字符串内,要用StrinG的‘+’。
发信人: Sailors (GiGi), 信区: Java
【 在 realchick (小鸡) 的大作中提到: 】
∶ 不是要用string的吗?
∶ 不能把变量放在字符串内,要用StrinG的‘+’。
这位大虾,我现在把我的这段程序列出,请指出错误,
有劳告诉在下怎么改.
pstmt1.executeUpdate("INSERT INTO resultable1 VALUES(rateofstable[0],rateof
stable[1],rateofstable[2],rateofstable[3],rateofstable[4],rateofstable[5],ra
teofstable[6],rateofstable[7],rateofstable[8],rateofstable[9],rateofstable[1
0],rateofstable[11],rateofstable[12],rateofstable[13],rateofstable[14],rateo
fstable[15])");
其中,rateofstable[]是一个数组.
发信人: realchick (小鸡), 信区: Java
【 在 Sailors (GiGi) 的大作中提到: 】
∶ 这位大虾,我现在把我的这段程序列出,请指出错误,
∶ 有劳告诉在下怎么改.
∶ pstmt1.executeUpdate("INSERT INTO resultable1 VALUES(rateofstable[0],rateof
∶ stable[1],rateofstable[2],rateofstable[3],rateofstable[4],rateofstable[5],ra
∶ teofstable[6],rateofstable[7],rateofstable[8],rateofstable[9],rateofstable[1
∶ 0],rateofstable[11],rateofstable[12],rateofstable[13],rateofstable[14],rateo
∶ fstable[15])");
∶ 其中,rateofstable[]是一个数组.
我想应该是
pstmt1.executeUpdate("INSERT INTO resultable1 values("+rateofstable[0]+","
+rateofteofstable[6]+","+rateofstable[2]+.................
后面应该是以此类推就行了.希望你调试成功。
发信人: jjhwang (小受), 信区: Java
你干嘛不用个循环来构造这个SQL语句?
//faint
况且了,还要看这个数组里的值是什么。
假如是字符串,在它外面还要加上单引号''。
总之,一切要视具体情况而定,不能统统照搬。
Good luck!
【 在 realchick (小鸡) 的大作中提到: 】
∶ 我想应该是
∶ pstmt1.executeUpdate("INSERT INTO resultable1 values("+rateofstable[0]+","
∶ +rateofteofstable[6]+","+rateofstable[2]+.................
∶ 后面应该是以此类推就行了.希望你调试成功。
发信人: Sailors (GiGi), 信区: Java
【 在 realchick (小鸡) 的大作中提到: 】
∶ 我想应该是
∶ pstmt1.executeUpdate("INSERT INTO resultable1 values("+rateofstable[0]+","
∶ +rateofteofstable[6]+","+rateofstable[2]+.................
∶ 后面应该是以此类推就行了.希望你调试成功。
果然是大虾级的人物,大虾一出手,问题就没有.
BBS水木清华站∶精华区