Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updateable query problem.

Status
Not open for further replies.

qwert231

Programmer
Sep 4, 2001
756
US
I get the message that I must use an updatable query to update, but I thought I was using an updatable query. Here is the code... the Sub is in an included file, but I combined them to make it easier.

strInsert = "INSERT INTO Basket(JobNumber, PhotoID, BasketID" & strFields & ") VALUES ('" & job & "','" & imgVal & "','" & bsktNum & strValues & "')"
Call RecInsert(strInsert)

Sub RecInsert(ins)
Set Comm = Server.CreateObject("ADODB.Command")
Comm.ActiveConnection = strC
Comm.CommandText = ins
Comm.CommandType = adCmdText
Comm.Execute
Comm.Close
Set Comm = Nothing
End Sub
 
Did you tryed to run the same query in the Query Analizer?
 
I tried your code and it works with the exception comm.close.
Command objects do not have a close method.

Check your sql string to ensure it is correct.

Is your strC glodal and accessable by the sub.
 
Where/What is Query Analizer?

I've also tried with replacing the string:
Conn.Execute("INSERT INTO Basket(JobNumber, PhotoID, BasketID) VALUES ('214423','0018','1')")
 
The DB is Access or SQL?
If is Access in the Query Window. Try to run this insert statement INSERT INTO Basket(JobNumber, PhotoID, BasketID) VALUES ('214423','0018','1') directly in Acccess (or whatever you have) and see if it's working.

If yes, then the problem resides on the ASP page, when you create the Command Object.
 
Yes, it is Access, and I did run the query from inside, and it works... so it is ASP problem... but now what?
 
Try to use this. It should work!

Set objConn = CreateObject("ADODB.Connection")
objConn.ConnectionString = GetConnection()'here is the connection string
objConn.open

'or if you use DNS then the 3 lines from above would be:
Set objConn = CreateObject("ADODB.Connection")
objConn.open DNS


Set objCmd = CreateObject("ADODB.Command")
Set objCmd.ActiveConnection = objConn
objCmd.CommandTimeout = 0
objCmd.CommandText = "select * from tbl"
objCmd.CommandType = 1
objCmd.Execute


objConn.Close
Set objCmd = Nothing
Set objConn = Nothing
 
Currently I am calling the subfunction this way:
Sub RecInsert(ins)
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Mode = 3 '3 = adModeReadWrite
Conn.Open strC
Conn.Execute ("INSERT INTO Basket(JobNumber) VALUES ('214423')")
Set Conn = Nothing
End Sub

But to be safe, I tried laying it all out in the main page, no Sub, no variables... just like this:

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Mode = 3 '3 = adModeReadWrite
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Inetpub\ImageConnection\database\century.mdb;Persist Security Info=False"
Conn.Execute ("INSERT INTO Basket(JobNumber) VALUES ('214423')")
Set Conn = Nothing

Still get:
Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/addtobasket.asp, line 75


I am the only one using the database... I can't think what else might be doing it. I even tried giving the Annonymous user account Full Control over everything (it's a closed system, so I'm not to worried about security right now.) But nada.... WHAT AM I MISSING?!?!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top