Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: SQL INSERT problem


Message #1 by "Spencer Saunders" <ssaunders@i...> on Fri, 3 Aug 2001 12:52:21 -0400

Hello all.;





New to ASP but not to SQL yet I can't get around this one.

I am trying a simple SQL INSERT statement with data collected form a 

form page.



CODE

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



'first input the data sent from the previous page



dim insert

var1 =3D request.form("articlenumber")

var2 =3D request.form("title")

var3 =3D request.form("author")



sqltext=3D "INSERT INTO articles (articlenumber, title, author) VALUES(" 

& var1 & ", " & var2 & ", " & var3 & ")"





set insert=3DServer.CreateObject("ADODB.Recordset")



insert.open sqltext, "FileDSN=3Dspunki02.dsn"

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





but after this last line I am getting the following error

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'



[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 

2.



/insert_data2.asp, line 38





What other parameter am I missing here???



Thanks for any help



the_munk





Message #2 by "Ethan Selzer" <ethanselzer@m...> on Fri, 3 Aug 2001 12:08:22 -0700
Hi,



This error will occur when the column name used in the query syntax does not

exist.



Double check your for spelling errors.



Good luck,

Ethan



-----Original Message-----

From: Spencer Saunders [mailto:ssaunders@i...]

Sent: Friday, August 03, 2001 10:56 AM

To: Access ASP

Subject: [access_asp] SQL INSERT problem





Hello all.;





New to ASP but not to SQL yet I can't get around this one.

I am trying a simple SQL INSERT statement with data collected form a 

form page.



CODE

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



'first input the data sent from the previous page



dim insert

var1 =3D request.form("articlenumber")

var2 =3D request.form("title")

var3 =3D request.form("author")



sqltext=3D "INSERT INTO articles (articlenumber, title, author) VALUES(" 

& var1 & ", " & var2 & ", " & var3 & ")"





set insert=3DServer.CreateObject("ADODB.Recordset")



insert.open sqltext, "FileDSN=3Dspunki02.dsn"

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





but after this last line I am getting the following error

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'



[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 

2.



/insert_data2.asp, line 38





What other parameter am I missing here???



Thanks for any help



the_munk





Message #3 by Andy@a... on Wed, 8 Aug 2001 07:46:47
Hi



Something I've noticed with your code - if you are writing back strings 

you need an extra set of quotes around the value variables ie 



'" & Var1 & "' if you are writing back numbers then " & qFormNumber & "



Hope this helps



Regards



Andy Green





> 





> Hello all.;

> 

> 

> New to ASP but not to SQL yet I can't get around this one.

> I am trying a simple SQL INSERT statement with data collected form a 

> form page.

> 

> CODE

> ----------------------------

> 

> 'first input the data sent from the previous page

> 

> dim insert

> var1 =3D request.form("articlenumber")

> var2 =3D request.form("title")

> var3 =3D request.form("author")

> 

> sqltext=3D "INSERT INTO articles (articlenumber, title, author) VALUES(" 



> & var1 & ", " & var2 & ", " & var3 & ")"

> 

> 

> set insert=3DServer.CreateObject("ADODB.Recordset")

> 

> insert.open sqltext, "FileDSN=3Dspunki02.dsn"

> ---------------------------

> 

> 

> but after this last line I am getting the following error

> Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

> 

> [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 

> 2.

> 

> /insert_data2.asp, line 38

> 

> 

> What other parameter am I missing here???

> 

> Thanks for any help

> 

> the_munk

> 

> 


  Return to Index