Results 1 to 8 of 8

Thread: Asp Beginner, Need to Help

  1. #1

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496

    Asp Beginner, Need to Help

    Hello, I am new to ASP programming, so I would like to get some help from the rest of you guys. I can't figure out what is wrong in this page, but it's not updating my database. Anyone?? I can execute the stored proc from the query analyzer.


    Code:
    <%
      Option Explicit
      
      Dim objCn
      Dim objCmd
      Dim xmlDoc
      Dim xmlResponse
      Dim objPar
      Dim strXMLRequest
      Dim strConnectionString
      
      Const adCmdStoredProc = 4
      Const adParamInput = 1
      Const adVarChar = 200
      
      On Error Resume Next
    
      Set objCn = CreateObject("ADODB.Connection")
      Set objCmd = CreateObject("ADODB.Command")
      Set objPar = CreateObject("ADODB.Parameter")  
      
      strConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BackDate;Data Source=NETICE"
      
      objCn.Open strConnectionString
      With objCmd
    	.ActiveConnection = objCn
    	.CommandType = adCmdStoredProc
    	.CommandText = "Add_BackDate"
      End With
      
      With objCmd
        .Parameters.Append objCmd.CreateParameter ("AssociateID", adVarChar, adParamInput, 8, "91904451")
        .Parameters.Append objCmd.CreateParameter ("AssociateLName", adVarChar, adParamInput, 40, "Yields")
        .Parameters.Append objCmd.CreateParameter ("AssociateFName", adVarChar, adParamInput, 40, "Dan")
        .Parameters.Append objCmd.CreateParameter ("OrderNumber", adVarChar, adParamInput, 9, "030263578")
        .Parameters.Append objCmd.CreateParameter ("Operator", adVarChar, adParamInput, 6, "L00m2p")
        .Execute 
      End With
      Response.Write "Done!"  
    %>

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    I don't see any obvious errors. Try this for all your params:

    VB Code:
    1. .Parameters.Append(.CreateParameter("AssociateID", adVarChar, adParamInput, Len("91904451"), "91904451"))
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    I just started coding in ASP as well and had the exact same problem. In ASP, you don't need to define the CommandType like you do in VB

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    ??? But VB or ASP would both be talking to the same DLL. It works fine for me.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    I don't know I was kept getting an error in a page and it kept pointing to the command type and I asked another guy I worked with and he said that I didn't need that. I took it out and it worked fine. Got me.

  6. #6
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Weird. This is what I use and it works fine:
    VB Code:
    1. With cmd
    2.     .CommandType = &H0004 'sproc
    3.     '...
    4. End With

    I get the values for the constant from a copy of ADOVBS.INC I printed out and keep on my desk.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  7. #7
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    Maybe it is this, it was what I was using..
    Code:
    With cmd
       .CommandType = adCmdStoredProc
    End With
    Anyways, it works without specifying the command type also.

  8. #8
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    OK. I've been told that ADO works faster when you explicitly tell it stuff like that though.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

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



Click Here to Expand Forum to Full Width