Problem with update statement.

Discussion in 'Web Design, HTML And CSS' started by Mastakays, Feb 29, 2008.

  1. Mastakays

    Mastakays New Member

    Joined:
    Feb 29, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello there guys.

    I have a problem with my update statement onto the database.
    I have a site that works fine on my local host and on the server but now Ive jus posted, the "working site" onto the ftp folder of the company that hosts if for us.But I have found that it doesn't work coz of the read/write permissions onto the database.How can I solve this coz I have granted read/write permissions in the database properties.

    But I keep getting this error when I try to login.:Error # -2147467259 Operation must use an updateable query.
    SQL = UPDATE tbl_employees SET lastlogin = #29-Feb-2008# WHERE employeelogin = 'SIPHOSIBUYANE'

    Here is my asp code:
    Code:
    <!--
    '*******************************************************************************************
    
    '******************************************************************************************** 
    -->
    <!--#include file="SiteSQL.asp"-->
    <%
    '** CONNECTION STRING
    'Dim conn
    'strConn = DB_CONNECTIONSTRING	
    'set conn=server.createobject("adodb.connection")
    'conn.Open strConn
    'conn.Mode = 3
    Dim conn, ConnectString
    ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("data/intranet.mdb") & ";Persist Security Info=False"
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.open ConnectString
    %>
    <%
    Private function RunSQL(ByVal sql,ByRef myRS)
    	'Response.Write sql & "<BR>"
    	On Error Resume Next
    	if lcase(left(trim(sql),6)) = "select" then
    			set myRS = server.CreateObject("adodb.recordset")
    			myRS.open sql,conn,3,3
    	else
    		select case lcase(left(trim(sql),6))
    			case "update", "delete"
    				if instr(lcase(sql),"where") = 0 then
    					response.write "Dork, you tried to run a "& lcase(left(trim(sql),6)) &" query without the where clause!"
    					boolDoNotRunQuery = true
    					response.end
    				end if
    		end select 
    		if boolDoNotRunQuery <> true then
    			set myRS = conn.Execute(sql)
    		end if
    	end if
    	if err.number <> 0 then
    		Response.Clear
    		Response.Write "Error Occured:<BR><BR>"
    		Response.Write "Error # " & CStr(Err.Number) & " " & Err.Description & "<BR>" 
    		Response.Write "SQL = " & sql & "<BR>"	
    		Response.End
    	End if
    	On Error Goto 0	
    end Function
    
    Private function DoSQL(ByVal sql)
    	'Response.write sql & "<BR>"
    	On Error Resume Next
    	boolDoNotRunQuery = FALSE
    	actionWord = left(trim(sql),6)
    	select case lcase(actionWord)
    		case "update", "delete"
    			if instr(lcase(sql),"where") = 0 then
    				response.write "Dork, you tried to run a "& lcase(left(trim(sql),6)) &" query without the where clause!"
    				boolDoNotRunQuery = true
    				response.end
    			end if
    	end select
    	if boolDoNotRunQuery <> true then
    		conn.Execute(sql)
    	end if
    	if err.number <> 0 then
    		Response.Clear
    		Response.Write "Error Occured:<BR><BR>"
    		Response.Write "Error # " & CStr(Err.Number) & " " & Err.Description & "<BR>" 
    		Response.Write "SQL = " & sql & "<BR>"	
    		Response.End
    	End if
    	On Error Goto 0	
    end Function
    Im better with asp.net, so even if someone can help me remove the update statement or help me fix this problem.
     
    Last edited by a moderator: Feb 29, 2008
  2. venkatesanj@hcl.in

    venkatesanj@hcl.in New Member

    Joined:
    Oct 19, 2007
    Messages:
    24
    Likes Received:
    1
    Trophy Points:
    0
    Create a stored procedure with update statement in it.

    You can send the arguments to the stored procedure and execute it from the front end

    Regards,
    Venkatesan Prabu. J
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice