|
-
Oct 16th, 2001, 07:39 PM
#1
Thread Starter
PowerPoster
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!"
%>
-
Oct 17th, 2001, 06:54 AM
#2
Black Cat
I don't see any obvious errors. Try this for all your params:
VB Code:
.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.
-
Oct 17th, 2001, 03:53 PM
#3
Frenzied Member
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
-
Oct 18th, 2001, 06:24 AM
#4
Black Cat
??? 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.
-
Oct 18th, 2001, 08:35 AM
#5
Frenzied Member
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.
-
Oct 18th, 2001, 10:46 AM
#6
Black Cat
Weird. This is what I use and it works fine:
VB Code:
With cmd
.CommandType = &H0004 'sproc
'...
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.
-
Oct 19th, 2001, 10:04 AM
#7
Frenzied Member
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.
-
Oct 19th, 2001, 10:32 AM
#8
Black Cat
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|