473,322 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Call Stored procedure from ASP page

Soniad
66
Hello,

I am calling stored procedure in ASP page as follows :

Expand|Select|Wrap|Line Numbers
  1.     Dim oCmdDim,confirmation,IndRecs
  2.     Set oCmd = Server.CreateObject("ADODB.Command")
  3.  
  4.     With  oCmd 
  5.     .ActiveConnection = openconnection()
  6.     .CommandType = 4
  7.     .CommandText = "SendMsg_proc"
  8.  
  9.  
  10.     .Parameters.Append(.CreateParameter("@UniCode", adVarWChar, adParamInput, 1, "'"& request("unicode") & "'"))
  11.     .Parameters.Append(.CreateParameter("@DintUserId", adnumeric, adParamInput, 9, "'"& Session("userid") & "'" ))
  12.     .Parameters.Append(.CreateParameter("@DintOrg_id", adnumeric, adParamInput, 9, "'"& Session("orgid") & "'" ))
  13.     .Parameters.Append(.CreateParameter("@Gdate", adDBDate, adParamInput, 15, "'"& Request("Gdate") & "'" ))
  14.     .Parameters.Append(.CreateParameter("@GTime", adDBDate, adParamInput, 15, "'"& Request("GTime") & "'" ))
  15.     .Parameters.Append(.CreateParameter("@ProductId", adVarWChar, adParamInput, 50, "'"& Session("productid") & "'" ))
  16.     .Parameters.Append(.CreateParameter("@recids", adVarWChar, adParamInput, 8000, "'"& recids & "'" ))        
  17.     .Parameters.Append(.CreateParameter("@grpids", adVarWChar, adParamInput, 8000, "'"& grpids & "'" ))        
  18.     .Parameters.Append(.CreateParameter("@preferedGroup", adVarWChar, adParamInput, 8000,  "'"& Request("preferedGroup") & "'" ))        
  19.     .Parameters.Append(.CreateParameter("@unRegRec", adVarWChar, adParamInput, 8000, "'"& Request("textareaunreg") & "'"))        
  20.     .Parameters.Append(.CreateParameter("@Message", adVarWChar, adParamInput, 8000,"'"& Request("textareamobile") & "'"))                
  21.     .Parameters.Append(.CreateParameter("@DvchMsgType", adVarWChar, adParamInput, 50, "'"& Request("tflash") & "'" ))                
  22. '    .Parameters.Append(.CreateParameter("@NoOfMessages", adVarWChar, adParamInput, 9, int(Request("NoOfMessages"))))        
  23.     .Parameters.Append(.CreateParameter("@EmailMsgBal", adnumeric, adParamInput, 9, "'"& Request("EmailBal") & "'" ))        
  24.     .Parameters.Append(.CreateParameter("@GrBal", adnumeric, adParamInput, 9, "'"& Request("GrBal") & "'" ))
  25.     .Parameters.Append(.CreateParameter("@AccType", adVarWChar, adParamInput,15, "'"& lcase(trim(session("admin"))) & "'" ))                    
  26.     .Parameters.Append(.CreateParameter("@SmsGeneral", adInteger, adParamInput,4, "'"& SmsGeneral & "'" ))                    
  27.     .Parameters.Append(.CreateParameter("@EmailGeneral", adInteger, adParamInput,4,"'"&  EmailGeneral & "'" ))                    
  28.     .Parameters.Append(.CreateParameter("@vchfree", adVarWChar, adParamInput, 10, "'"& Request("Free") & "'" ))                
  29.     .Parameters.Append(.CreateParameter("@vchnormal", adVarWChar, adParamInput, 10,"'"& Request("NORMAL") & "'" ))                
  30.     .Parameters.Append(.CreateParameter("@invite", adVarWChar, adParamInput, 10, "'"&  Request("invite") & "'" ))        
  31.     .Parameters.Append(.CreateParameter("@status", adVarWChar, adParamInput, 3, "'"& Request("status") & "'" ))                    
  32.     .Parameters.Append(.CreateParameter("@status1", adVarWChar, adParamInput, 3,"'"&  Request("status1") & "'"))                        
  33.     .Parameters.Append(.CreateParameter("@Confirm", adVarWChar, adParamOutput))
  34.  
  35.  
  36.     'On Error Resume Next
  37.     .Execute IndRecs,,adExecuteNoRecords
  38.     confirmation = .Parameters("@Confirm")
  39.  
  40.    End With 
  41.     'On Error Goto 0
  42.     If oCmd.ActiveConnection.Errors.Count > 0 Then
  43.         Response.Write("An error occured while trying to process your SP!")
  44.     Else
  45.         Response.Write("DONE - "& confirmation)
  46.     End If
  47.  
  48.     Set oCmd = Nothing
  49.  
In this , some parameters values are comma seperated . thus when executing this stored procedure , it throws followin error :

Expand|Select|Wrap|Line Numbers
  1.  
  2. ADODB.Command error '800a0bb9' 
  3.  
  4. Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. 
  5.  
  6.  
  7.  
On this line :

.ActiveConnection = openconnection()

how to deal with this problem, or how to pass parameters within single quotes.

Regards,
"D"
Jan 31 '09 #1
1 5169
jhardman
3,406 Expert 2GB
you should not have to use single quotes when you pass parameters like you do. Try it without, the act of appending parameters should allow the stored procedure to interpret each parameter as a single value even if it contains a comma. If single quotes were necessary I definitely would try it the same way you did above.

That said, the error you are reporting should not have come from that line, it should have come from the .Execute line, I don't know whether this sheds any new light on the issue or not...

Jared
Feb 2 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Luis | last post by:
I'm using code similar to the following in an asp page to call a stored procedure that does a select on a SQLServer 2000 table: dim rs, SelectSql SelectSql = "EXEC spSelectStuff @param = '" &...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
3
by: Mariusz | last post by:
I want to write function to call another function which name is parameter to first function. Other parameters should be passed to called function. If I call it function('f1',10) it should call...
4
by: Jean-Marc Blaise | last post by:
Dear all, I have simulated the windows MULTI application with a java program calling the SQLTP1DL proc referenced as DB2DARI application, on Linux Intel or ZLinux. If the proc is NOT FENCED,...
2
by: Marcin Belczewski | last post by:
I have ASP.NET page that invokes a stored procedure in the database. It takes about 60 seconds for the stored procedure to complete. In web.config I have <httpRuntime executionTimeout="10"/> and...
0
by: IamtheEvster | last post by:
Hi All, I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am unable to call a MySQL stored procedure that returns output parameters using mysql, mysqli, or PDO. I'm having a...
3
by: mandible | last post by:
I'm trying to call one stored procedure inside another. I was wondering if this is possible Some ideas I was toying with is putting the first stored procedure inside of a temp table but haven't...
3
by: .Net Sports | last post by:
I need to call an stored procedure from an asp script, I don't need to do an Output parameter, only input parameters on 3 vars, but I get a "BOF EOF not true or record has been deleted" error when...
2
by: savio XCIX | last post by:
I created the following stored procedure: ======= CREATE PROCEDURE TBLNAME.proc_test (IN p_custnum VARCHAR(8), IN p_zipcode...
12
by: barmatt80 | last post by:
I don't know if this is the right part of the forum. But.... I have been working all night trying to create a web service to call a stored procedure in sql server 2008. The stored procedure calls...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.