[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>&nbsp;</DIV>
<DIV>If i just switch it toa 0 or a 5 all my code works perfect.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I'm having trouble with this code:</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>it gives me this error:</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>----- Original Message -----=20
<DIV>From: "Danny Yoo" &lt;<A=20
href=3D"mailto:dyoo@hkn.eecs.berkeley.edu">dyoo@hkn.eecs.berkeley.edu</A>=
&gt;</DIV>
<DIV>To: "Ben" &lt;<A=20
href=3D"mailto:bfergo@ihug.com.au">bfergo@ihug.com.au</A>&gt;</DIV>
<DIV>Cc: &lt;<A =
href=3D"mailto:db-sig@python.org">db-sig@python.org</A>&gt;</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>&gt; <BR>&gt; <BR>&gt; On Tue, 4 Jun 2002, Ben =
wrote:<BR>&gt;=20
<BR>&gt; &gt; I'm having trouble using one of my instance integer =
variable in a=20
sql<BR>&gt; &gt; insert statement.<BR>&gt; &gt;<BR>&gt; &gt; Does Anyone =
have=20
any ideas how to fix this?<BR>&gt; <BR>&gt; Hi Ben,<BR>&gt; <BR>&gt; Can =
you=20
show us some of the code that you're using, as well as an error<BR>&gt;=20
message?&nbsp; Without this information, we're bound to misguess what's=20
going<BR>&gt; on.<BR>&gt; <BR>&gt; <BR>&gt; Talk to you later!<BR>&gt; =
<BR>&gt;=20
<BR>&gt; <BR>&gt; =
_______________________________________________<BR>&gt; DB-SIG=20
maillist&nbsp; -&nbsp; <A=20
href=3D"mailto:DB-SIG@python.org">DB-SIG@python.org</A><BR>&gt; <A=20
href=3D"http://mail.python.org/mailman/listinfo/db-sig">http://mail.pytho=
n.org/mailman/listinfo/db-sig</A><BR>&gt;=20
</FONT></DIV></BODY></HTML>

------=_NextPart_000_00AA_01C20BEB.08A02BD0--