Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: updateable query?


Message #1 by "Burc Kaya" <bkaya@f...> on Mon, 30 Apr 2001 18:36:33
Hi,



We are trying to insert a row into a table by using sqlstring.

When tha ASP file runs sqlstring in the database we get an an error :

"Operation must use an updateable query".



I tried to run the sql string in Acces and it worked. Access saves the 

query as an append query. Once after I run the query I noticed that the sql 

string changed, putting brackets around the last column. 

Acces Help defines this error mesage as 

"This error occurs when the current query's Update To row includes a field 

from either a crosstab query or select query in which an aggregate (total) 

was calculated for the field (using either the Totals row or a domain 

function in the Field row). To update a field using the aggregate of 

another field, calculate the aggregate in the update query itself, not a 

different query. "





the querystring

INSERT INTO CUBE ( BLDGNO, FLOOR, WING, AREANO, ORGCODE )

VALUES ('10', '1st', 'Vertical', '45666', '456');



that's how we saw it later

INSERT INTO CUBE ( BLDGNO, FLOOR, WING, AREANO, [ORGCODE] )

VALUES ('10', '1st', 'Vertical', '45666', '456');



We tried the Command object as well. However, it did not solve the problem.

and this is our code:



<%@LANGUAGE=VBSCRIPT%>



<%

Option Explicit

Dim userid

userid = Session("userid")



Dim objConn, objRS, sqlstring, strConn, message

strConn = "DSN=occupancy;"

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " &_			             

"Data Source=C:\inetpub\wwwroot\cubemgmt\occupancy.mdb"



Dim bldno, flrno, wingno, locorg, areano

bldno=request.form("bldno")

flrno=request.form("flrno")

wingno=request.form("wingno")

locorg=request.form("locorg")

areano=request.form("areano")



sqlstring = "INSERT INTO CUBE(BLDGNO, FLOOR, WING, AREANO,ORGCODE) "

sqlstring = sqlstring & " 

VALUES('"&bldno&"','"&flrno&"','"&wingno&"','"&locorg&"','"&areano&"');" 

 response.write sqlstring     ' to see the sqlstring on the page



objConn.Execute(sqlstring)



response.redirect "updatesuccess.asp"

%>





I would appreciate a quick response.

Thanks

Burc
Message #2 by Michael Filip <mzcfilip@y...> on Mon, 30 Apr 2001 11:50:42 -0700 (PDT)
"Operation must use an updateable query".

-->

This is most often permissions error.  Make sure your

IUSER account, or whichever account is used by IIS,

has modify permissions on the database itself and/or

the folder containing your database.



HTH

 - michael



__________________________________________________

Do You Yahoo!?

Yahoo! Auctions - buy the things you want at great prices

http://auctions.yahoo.com/


  Return to Index