[DB-SIG] RE: SQL insert with integer variable
Ben
bfergo@ihug.com.au
Tue, 4 Jun 2002 17:12:40 +1000
This is a multi-part message in MIME format.
------=_NextPart_000_00AA_01C20BEB.08A02BD0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm using the htmlxmlsql2000db module.
If i just switch it toa 0 or a 5 all my code works perfect.
I'm having trouble with this code:
current_scene_int =3D 0
os.environ['http_proxy']=3D''
db=3Dhtmlxmlsql2000db.Connect(host=3D'isys3113.it.usyd.edu.au', =
db=3D'usyddb',user=3D'grouplogin',passwd=3D'group')
c=3Ddb.cursor()
query=3D"insert into playscene (scene_id,title,scene) Values =
(current_scene_int, '"+current_play+"','"+current_scene+"')"
c.execute(query)
it gives me this error:
"The name 'current_scene_int' is not permitted in this context. Only =
constants, expressions, or variables allowed here. Column names are not =
permitted.", 'HResult': '0x80040e14', 'Source': 'Microsoft OLE DB =
Provider for SQL Server'}
----- Original Message -----=20
From: "Danny Yoo" <dyoo@hkn.eecs.berkeley.edu>
To: "Ben" <bfergo@ihug.com.au>
Cc: <db-sig@python.org>
Sent: Tuesday, June 04, 2002 4:54 PM
Subject: Re: [DB-SIG] SQL insert with integer variable
>=20
>=20
> On Tue, 4 Jun 2002, Ben wrote:
>=20
> > I'm having trouble using one of my instance integer variable in a =
sql
> > insert statement.
> >
> > Does Anyone have any ideas how to fix this?
>=20
> Hi Ben,
>=20
> Can you show us some of the code that you're using, as well as an =
error
> message? Without this information, we're bound to misguess what's =
going
> on.
>=20
>=20
> Talk to you later!
>=20
>=20
>=20
> _______________________________________________
> DB-SIG maillist - DB-SIG@python.org
> http://mail.python.org/mailman/listinfo/db-sig
>=20
------=_NextPart_000_00AA_01C20BEB.08A02BD0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2715.400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV>I'm using the htmlxmlsql2000db module.</DIV>
<DIV> </DIV>
<DIV>If i just switch it toa 0 or a 5 all my code works perfect.</DIV>
<DIV> </DIV>
<DIV>I'm having trouble with this code:</DIV>
<DIV> </DIV>
<DIV>current_scene_int =3D 0</DIV>
<DIV>os.environ['http_proxy']=3D''<BR>db=3Dhtmlxmlsql2000db.Connect(host=3D=
'isys3113.it.usyd.edu.au',=20
db=3D'usyddb',user=3D'grouplogin',passwd=3D'group')<BR>c=3Ddb.cursor()</D=
IV>
<DIV>query=3D"insert into playscene (scene_id,title,scene) Values=20
(current_scene_int,=20
'"+current_play+"','"+current_scene+"')"<BR>c.execute(query)</DIV>
<DIV> </DIV>
<DIV>it gives me this error:</DIV>
<DIV> </DIV>
<DIV>"The name 'current_scene_int' is not permitted in this context. =
Only=20
constants, expressions, or variables allowed here. Column names are not=20
permitted.", 'HResult': '0x80040e14', 'Source': 'Microsoft OLE DB =
Provider for=20
SQL Server'}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>----- Original Message -----=20
<DIV>From: "Danny Yoo" <<A=20
href=3D"mailto:dyoo@hkn.eecs.berkeley.edu">dyoo@hkn.eecs.berkeley.edu</A>=
></DIV>
<DIV>To: "Ben" <<A=20
href=3D"mailto:bfergo@ihug.com.au">bfergo@ihug.com.au</A>></DIV>
<DIV>Cc: <<A =
href=3D"mailto:db-sig@python.org">db-sig@python.org</A>></DIV>
<DIV>Sent: Tuesday, June 04, 2002 4:54 PM</DIV>
<DIV>Subject: Re: [DB-SIG] SQL insert with integer variable</DIV></DIV>
<DIV><BR></DIV>> <BR>> <BR>> On Tue, 4 Jun 2002, Ben =
wrote:<BR>>=20
<BR>> > I'm having trouble using one of my instance integer =
variable in a=20
sql<BR>> > insert statement.<BR>> ><BR>> > Does Anyone =
have=20
any ideas how to fix this?<BR>> <BR>> Hi Ben,<BR>> <BR>> Can =
you=20
show us some of the code that you're using, as well as an error<BR>>=20
message? Without this information, we're bound to misguess what's=20
going<BR>> on.<BR>> <BR>> <BR>> Talk to you later!<BR>> =
<BR>>=20
<BR>> <BR>> =
_______________________________________________<BR>> DB-SIG=20
maillist - <A=20
href=3D"mailto:DB-SIG@python.org">DB-SIG@python.org</A><BR>> <A=20
href=3D"http://mail.python.org/mailman/listinfo/db-sig">http://mail.pytho=
n.org/mailman/listinfo/db-sig</A><BR>>=20
</FONT></DIV></BODY></HTML>
------=_NextPart_000_00AA_01C20BEB.08A02BD0--