Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Urgent Help .... ASP & Store procedure problem, thx!!
Message
 
 
À
27/02/2003 22:29:38
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00759232
Message ID:
00759239
Vues:
18
1. Why nRec is double? Should not it be integer?

2. Why you're converting to cInt and cStr ? They are already int and string. No harm, but looks useless to me.

>Hi everybody,
>
>I have strange problem about ASP, store procedure and COM. It always give me an error message "Type mismatch" on EXECUTE statement. Let me explain more detail about my program. I have an ASP page to call the COM object. That COM object also call a store procedure to return a complete code to the COM object. But I tested to call the COM object from VB application, it is work fine. It so strange. Anybody can help me? 100 thanks!!
>
>Please look at the below source code.
>
>
>
>ASP
>---
><%@language=VBScript transaction=required
><HTML>
><HEAD>
><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
><TITLE></TITLE>
></HEAD>
><BODY>
><%
>Dim objsp , x, y
>x = 1037
>Set objsp = Server.CreateObject("storprocdll.testproc")
>y = objsp.spupd( Cint(x),CStr("UPD"))
>if y = 1 then
>   response.write("Update Completed")
>else
>   response.write("No update ")
>end if
>Set objsp = Nothing
>
></BODY>
></HTML>
>
>VB COM
>------
>Public Function spupd (ByVal dblBat as integer, ByVal strTx as String) as integer
>
>Dim cn as new adodb.connection
>Dim rs as new adodb.recordset
>Dim cmd as new adodb.command
>Dim nRec as double
>
>cn.open "DSN=DB1;UID=sa;PWD=;"
>set cmd.activeconnection = cn
>cmd.commandtext = "rtv_sp1"
>cmd.commandtype = adcmdstoredproc
>cmd.parameters.append cmd.createparameter("@batno", adInteger, adParamInput, , dblBat)
>cmd.parameters.append cmd.createparameter("@txtype", adVarChar, adParamInput, , strTx)
>cmd.execute nRec
>
>if nRec > 0 then
>    spupd = 1
>else
>    spupd = 0
>end if
>End Fucntion
>
>Store Procedure
>---------------
>Create Procedure rtv_sp1
>    @batno int, @txtype varchar(255)
>as
>    update db1 set field1 = 100 where batno = @batno and txtype = @txtype
>
>
>
>Thank you very much ....
>
>Best Regards,
>
>Justy Chow
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform