September 21, 2011 at 3:45 am
Hi,
I am getting an error while compiling:
No value given for one or more required parameters
The code I am getting this error on is:
---------------------------------------------------------------
rs.open "SELECT @@IDENTITY AS NEW_ID FROM TB_ATTACHMENTS", dbconnection
if not rs.EOF then
thisID = trim(rs("NEW_ID"))
mySQLDMZ = "INSERT INTO TB_ATTACHMENTS (ATTACHMENT_ID, ATTACHMENT_TYPE, ATTACHMENT_TITLE, ATTACHMENT_SIZE, ATTACHMENT_NAME, ATTACHMENT, ATTACHMENT_HASH) VALUES ('" & thisID & "', " &_
"1," &_
"'" & Session("title0" & fI) & "'," &_
"'" & Session("fileSize0" & fI) & "'," &_
"'" & Session("fileName0" & fI) & "'," &_
"?," &_
"'" & Session("hash0" & fI) & "')"
dbconnectionDMZ.execute(mySQLDMZ)
rs.close
end if
------------------------------------------------------------------
Could someone pls help me in this regard ?
September 21, 2011 at 3:59 am
One of the parameters seems to be missing a value, impossible for us to tell which one.
I would however re-write this code to use a stored proc, rather than bulding up a sql statment with parameters.
September 21, 2011 at 6:15 am
Connection.Execute(sqlStatement) optionally returns a dataset. use that to get uthe update and the results in one pass.
i would use a two statement combo like this:
dim Conn ' As Object
set Conn = Server.Createobject("ADODB.Connection")
Conn.ConnectionString = "PROVIDER=SQLOLEDB;DATA SOURCE=D223;UID=WebUser;PWD=NotARealpassword;DATABASE=SandBox;"
Conn.Open
Dim MyRs 'As ADODB.Recordset
Set MyRs = Server.CreateObject("ADODB.Recordset")
MyRs.CursorLocation = 3 'adUseClient
dim sql 'As String
sql = "INSERT INTO [snipped for brevity]" & ";"
sql = sql & "SELECT SCOPE_IDENTITY(); As NEWID"
Set MyRs = Conn.Execute(sql)
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply