Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2004, 07:07 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default sntax error or acces violation

 Please help me. I am trying to delete the data in data base
 and at the same time delete three txt boxes in an asp page.
When the user hits delete function. The code I have written
gives me an error. Please help me with this error.



  if Request.Form("txtMode")="R" then

    objHistoryRate.Requery
    delFrom = Request.Form("txtdelFrom")
    delTo = Request.Form("txtdelTo")
    delRate = Request.Form("txtdelRate")
  strDel = "delete from tblCustRate"
    if resType ="E" then
      strDel = strDel & " where iEmpID =" & iEmpID
    else
      strDel = strDel & " where iSubcontID =" & iSubcontID
    end if
      strDel = strDel & " and iTaskiD = " & iTaskID&_
    if delFrom ="" then
            strDel = strDel + " and dtRateFrom is null"
         else
             strDel = strDel + " and dtRateFrom='" &delFrom &"'"
         end if
        if delTo="" then
          strDel = strDel + " and dtRateTo is null"
        else
            strDel = strDel + " and dtRateTo='" &delTo &"'"
        end if
        if delRate="" then
          strDel = strDel + " and decHourlyRate is null"
        else
          strDel = strDel + " and decHourlyRate=" &delRate
        end if


    end if
                            " and iProjDetiD = " & iProjDetID

    set objConn1=Server.CreateObject("ADODB.Connection")
    objConn1.ConnectionString = Application("HR2000Conn_ConnectionString")
    objConn1.Open
    set objCommand=Server.CreateObject("ADODB.Command")
    objCommand.ActiveConnection=objConn1
    objCommand.CommandType=4
    objCommand.CommandText=strDel
    'set objHistoryRate = objCmd.Execute
    'Response.Write strDel
    objCommand.Execute






Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Error: Syntax Error or Access Violation codehappy VB How-To 7 October 3rd, 2007 05:41 PM
Violation of primary key dhoward VB.NET 2002/2003 Basics 4 May 31st, 2007 10:19 AM
Primary Key Violation error code hasanali00 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 April 19th, 2005 07:41 PM
Access Violation ? T-5 Beginning PHP 1 July 24th, 2004 09:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.