|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Jul 2002
Messaggi: 1608
|
[VB6 - Stored Procedure sql2005]
devo eseguire una stored procedure su sql passando dei parametri da vb6:
vi posto quello che ho scritto, ma mi ritorna un errore nel recordset ( l' operazione non è cosentita se l' oggetto è chiuso) set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[spWrkOrdiniImpegniGetLastNumber] @TipoDocumento int, @DocAnno int, @DocAlfa VarChar(2) As Declare @DocProgressivo int Select Top 1 @DocProgressivo = DocProgressivo From OrdiniImpegni Where TipoDocumento = @TipoDocumento And DocAnno = @DocAnno And IsNull(DocAlfa,'') = @DocAlfa And DocProgressivo <> 0 Order by DocProgressivo DESC Set @DocProgressivo = IsNull(@DocProgressivo,0) + 1 Return @DocProgressivo IL CODICE VB6 TipoDocumento = 54002 DocAnno = 2009 DocAlfa = "I" Dim cmd As ADODB.Command Set cmd = New ADODB.Command With cmd .ActiveConnection = CNSQL .CommandType = adCmdStoredProc .CommandText = "spWrkOrdiniImpegniGetLastNumber" .Parameters.Append cmd.CreateParameter_ ("@tipodocumento", adInteger, adParamInput, 6, TipoDocumento) .Parameters.Append cmd.CreateParameter_ ("@docanno", adInteger, adParamInput, 4, DocAnno) .Parameters.Append cmd.CreateParameter_ ("@docalfa", adVarChar, adParamInput, 2, DocAlfa) End With Set TMP = New ADODB.Recordset Set TMP = cmd.Execute If Not TMP.EOF Then txt_number = TMP.Fields(0) End If PS: CNSQL (la stringa di connessione a sql è ok) HELP ME! grazie in anticipo
__________________
Asus P8P67 DLX, I7-2600K @ 4.00 Ghz, Thermalright True120, 8Gb Corsair Vengeance 1600 Mhz; gtx 760 DCII 2gb, Corsiar 520W, Cooler Master Cosmos 1000, SSD Corsair GT sata3 120Gb, 2 x WD 2TB + WD 500Gb+400Gb+ ..+ ..~ƒ☺
Ultima modifica di bertani8 : 09-12-2009 alle 23:47. |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 01:54.