Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SQL insert


Message #1 by "Jernej" <praprotnik@h...> on Thu, 25 May 2000 15:30:33 +0200
I have a problem with putting the variables into the strSQLQuery.

If I try with the code written below, I populate my database with 

strName, strAddress and strDescription and not with their values.



When I tried with

strSQLQuery =3D "INSERT INTO naslovi (Name, Address, Description) VALUES 

(strName, strAddress, strDescription)"

...the result was:



Error Type:

Microsoft JET Database Engine (0x80040E10)

No value given for one or more required parameters.

/asp/dodaj/dodaj.asp, line 22



How should I write the strSQLQuery, to put in desired values?





CODE:

--------------

18: strName =3D  Request.Form("Name")

19: strAddress =3D Request.Form("Address")

20: strDescription =3D Request.Form("Description")



22: strSQLQuery =3D "INSERT INTO naslovi (Name, Address, Description) 

VALUES ('strName', 'strAddress', 'strDescription')"

23: Set rs =3D Server.CreateObject("ADODB.Recordset")

24: rs.Open strSQLQuery, conn, 3, 3

--------------



Thx a lot,

Jernej

Message #2 by =?iso-8859-1?Q?Gonzalo_Ruiz_de_Villa_Su=E1rez?= <gonzalo.ruizdevilla@a...> on Thu, 25 May 2000 15:58:44 +0200
Perhaps it should be



strSQL = "INSERT INTO naslovi  (Name, Address, Description) "

strSQL = strSQL & " VALUES = ( " & strName " , " & strAddress & " , "

strDescription " )"



And then try



	Response.Write strSQL



to find out what is in the sql string.



Hope it can help.



-----Mensaje original-----

De: Jernej 

Enviado el: jueves, 25 de mayo de 2000 15:31

Para: ASP Databases

Asunto: [asp_databases] SQL insert





I have a problem with putting the variables into the strSQLQuery.

If I try with the code written below, I populate my database with 

strName, strAddress and strDescription and not with their values.



When I tried with

strSQLQuery =3D "INSERT INTO naslovi (Name, Address, Description) VALUES 

(strName, strAddress, strDescription)"

...the result was:



Error Type:

Microsoft JET Database Engine (0x80040E10)

No value given for one or more required parameters.

/asp/dodaj/dodaj.asp, line 22



How should I write the strSQLQuery, to put in desired values?





CODE:

--------------

18: strName =3D  Request.Form("Name")

19: strAddress =3D Request.Form("Address")

20: strDescription =3D Request.Form("Description")



22: strSQLQuery =3D "INSERT INTO naslovi (Name, Address, Description) 

VALUES ('strName', 'strAddress', 'strDescription')"

23: Set rs =3D Server.CreateObject("ADODB.Recordset")

24: rs.Open strSQLQuery, conn, 3, 3

--------------



Thx a lot,

Jernej


  Return to Index