I installed SQL Server and wrote my StoredProcedures in SQL, then wrote
below commands for connection to database in VB6.0:
and my StoredProcedure is:VB Code:
Set Cnn = New ADODB.Connection Set Rss = New ADODB.Recordset Set cmd = New ADODB.Command Cnn.ConnectionString = provider Cnn.Open cmd.ActiveConnection = Cnn cmd.CommandText = "CounterDoc_View" 'storedprocedurd name! cmd.Parameters.Append cmd.CreateParameter("@DocID", adInteger, adParamInput, 4, id) cmd.Parameters.Append cmd.CreateParameter("@UserLanguage", adChar, adParamInput, 2, UserLanguage) cmd.Parameters.Append cmd.CreateParameter("@LoginName", adVarChar, adParamInput, 50, Loginname) cmd.CommandType = adCmdStoredProc cmd.CommandTimeout = 0 cmd.Prepared = True Set Rss = cmd.Execute
after execution of my program in VB6.0 on this command "If Not Rss.EOFCode:CREATE PROCEDURE CounterDoc_View @DocID int, @UserLanguage char(2), @LoginName nvarchar(50) as Declare @TemSqlStr as varchar(4000) Set @TemSqlStr='Select LoginName, Name, Family, ID ' if (@UserLanguage='En') Set @TemSqlStr=@TemSqlStr+', FirstAccessDate, LastAccessDate ' else Set @TemSqlStr=@TemSqlStr+' ,dbo.Jal2Ch(FirstAccessDate) as FirstAccessDate, dbo.Jal2Ch(LastAccessDate) as LastAccessDate ' Set @TemSqlStr=@TemSqlStr+' From View_DocCounter where ID<>0 ' Set @TemSqlStr=@TemSqlStr+' and (ID ='+Convert(varchar(5), @DocID)+') ' if ((@LoginName!='') and (@LoginName!='Empty') and (@LoginName is not Null)) Set @TemSqlStr=@TemSqlStr+' and LoginName='''+@LoginName+'''' Exec (@TemSqlStr) Go
Then" (and when program wants retrieve resuls of execution of SP)below
error will be appear:
"operation is not allowed,when the object is closed"
Thanks for your attention to me.
Regards!




Reply With Quote