SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error Inserting new records

    Hi i am trying to insert new records by using a stored procedure with the following code:

    PHP Code:
    <%
    Dim Connection
    Dim Command
    Dim Records
    Dim Count
    Dim CurrentService

    Set Connection 
    Server.CreateObject("ADODB.Connection")
    Connection.Open Application("conn")

    Set Command Server.CreateObject("ADODB.Command")
    Set Command.ActiveConnection Connection
    Command
    .CommandType adCmdStoredProc 'Call the stored procedure here

    Select Case Request("Action")
        Case "Create"        
            Command.CommandText = "spTaxiBookingCreate" '
    Call the type of stored procedure here
            Command
    .Parameters.Append Command.CreateParameter("@theDate"adDateadParamInput'Append Parameters
            Command.Parameters.Append Command.CreateParameter("@theTime", adDate, adParamInput)
            Command.Parameters.Append Command.CreateParameter("@Location", adVarWChar, adParamInput, 50)
            Command.Parameters.Append Command.CreateParameter("@DropOff", adVarWChar, adParamInput, 50)
            Command.Parameters.Append Command.CreateParameter("@Paid", adInteger, adParamInput)
            Command.Parameters.Append Command.CreateParameter("@Notes", adVarWChar, adParamInput, 3600)
            Command.Parameters("@theDate") = Request("theDate")
            Command.Parameters("@theTime") = Request("theTime")
            Command.Parameters("@Location") = Left(Request("Location"), 50)
            Command.Parameters("@DropOff") = Left(Request("DropOff"), 50)
            Command.Parameters("@Paid") = CInt(Request("Paid"))
            Command.Parameters("@Notes") = Left(Request("Notes"), 3600)
            Command.Execute 
            Command.Parameters.Delete 1 '
    theDate --- Clear Parameters from memory
            Command
    .Parameters.Delete 1 'theTime
            Command.Parameters.Delete 1 '
    Location
            Command
    .Parameters.Delete 1 'DropOff
            Command.Parameters.Delete 1 '
    Paid
            Command
    .Parameters.Delete 1 'Notes
        
        End Select

    Command.CommandText = "spTaxiBookings"
    Set Records = Server.CreateObject("ADODB.Recordset")
    Records.Open Command, , adOpenStatic
    %> 
    In get the following error:

    Microsoft SQL Native Client error '80040e14'

    A server cursor cannot be opened on the given statement or statements. Use a default result set or client cursor.
    Referring to this line:

    PHP Code:
    Records.Open Command, , adOpenStatic 
    Any ideas what the problem might be?

    Thanks
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  2. #2
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,868
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)
    Is this classic asp.old? As it does not look like VB.NET.

  3. #3
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it's classic asp

    Started a new job as a Software Engineer building web applications for internal systems. So some of the applications are in classic ASP.

    What do you think the problem is? I did some research and found that it may be to do with the stored procedure in regards adding "SET NOCOUNT ON" but i have already done this so i am slightly confused..

    Any ideas?
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  4. #4
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,868
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)
    hmmm. Sorry. All my knowledge of asp.old has long been forgotten. lol. Good luck though with those applications. Hopefully someone here can assist you

  5. #5
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats ok thanks anyway

    Will be moving onto ASP.NET MVC next week should be exciting
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  6. #6
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    There is a classic ASP forum here that would most likely be able to help you.

  7. #7
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, can someone please very kindly move this thread to the classic ASP forum?

    Much appreciated
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  8. #8
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,608
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    http://www5.brinkster.com/hiflyer/db/dbtest3.asp

    Some info there regarding cursortypes etc. (Not saying it will help, but at least it's somewhere to start).
    Ian Anderson
    www.siteguru.co.uk

  9. #9
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    675
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is actually an ADO question, but here is a link to some example code for returning a recordset from a stored procedure.

    [google is your friend]

    http://www.eggheadcafe.com/PrintSear...asp?LINKID=407


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •