I installed SQL Server and wrote my StoredProcedures in SQL, then wrote
below commands for connection to database in VB6.0:
VB Code:
  1. Set Cnn = New ADODB.Connection
  2. Set Rss = New ADODB.Recordset
  3. Set cmd = New ADODB.Command
  4. Cnn.ConnectionString = provider
  5. Cnn.Open
  6. cmd.ActiveConnection = Cnn
  7. cmd.CommandText = "CounterDoc_View" 'storedprocedurd name!
  8.  
  9. cmd.Parameters.Append cmd.CreateParameter("@DocID", adInteger,
  10. adParamInput, 4, id)
  11. cmd.Parameters.Append cmd.CreateParameter("@UserLanguage", adChar,
  12. adParamInput, 2, UserLanguage)
  13. cmd.Parameters.Append cmd.CreateParameter("@LoginName", adVarChar,
  14. adParamInput, 50, Loginname)
  15.  
  16. cmd.CommandType = adCmdStoredProc
  17. cmd.CommandTimeout = 0
  18. cmd.Prepared = True
  19. Set Rss = cmd.Execute
and my StoredProcedure is:

Code:
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
after execution of my program in VB6.0 on this command "If Not Rss.EOF
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!