June 10, 2005 at 9:50 am
Hello friends, exists some friend that have a visual basic script to capture the prints of sp using ADOBD or something?
for example
create proc hello
as
begin
print 'Hello'
end
i need to build a dll that capture 'Hello' and show me, thanks for your help,
June 10, 2005 at 9:52 am
I already answered that question for you.
BTW, what do you mean by show?
Do you want to have a messagebox? an html (asp, aspx) file? a form?
June 10, 2005 at 9:56 am
i need to display the print into a messagebox... thanks
June 10, 2005 at 9:58 am
Just run the proc you just created (into a recordset)
in you don't have any records, check the errors collection for your messages, they should be there. Then you'll simply have to concatenate and show them.
June 10, 2005 at 10:01 am
Friend, Do you have some scritp of example to do that???
June 10, 2005 at 10:05 am
No and I don't have .net installed here.
Err.. in what language did you need this already?
June 10, 2005 at 10:11 am
i need Only a visual basic code...
for example
set objsDB = Server.CreateObject("ADODB.Connection")
'oConnDB.CursorType = 3; //adOpenStatic
objsDB.CursorLocation = adUseClient
objsDB.ConnectionString = AppCacheRead("DSN_OPTIONAL",msUserID,mlSiteID,msSessionID)
objsDB.Open()
set oCmd = Server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = objsDB
oCmd.CommandText = "exec CP_IncidentReassign " & cstr(mlSiteID) & ",'ESP','" & msUserID & "','" & Valor_Bus & "','" & Valor_Bus2 & "'"
oCmd.CommandType = adCmdText
set oRS = oCmd.Execute()
-------------------------------------------------------------------
but i dont know how to capture the prints of sp.......
June 10, 2005 at 10:17 am
after the open statement :
Dim Er 'As Error
For Each Er In objsDB.Errors
MsgBox Er.Description & " : " & Er.Source & " : " & Er.SQLState & " : " & Er.Number
Next
June 10, 2005 at 11:20 am
Alas, why this proc i cant capture the print 'hello' ?????????
create proc SP_test
as
begin
select '1'
print 'hello'
select '2'
end
----------------------------------------------------------------------
My visual script
--------------------------------------------------------------------------
Set cnn1 = New ADODB.Connection
cnn1.ConnectionString = "driver={SQL Server};" & _
"server=" & Trim(server) & ";uid=" & Trim(login) & ";pwd=" & Trim(pwd) & ";database=" & Trim(base)
cnn1.ConnectionTimeout = 120
cnn1.Open
Set reg = New ADODB.Recordset
Set reg = cnn1.Execute("exec SP_test")
error:
Dim Err As error
For Each Err In cnn1.Errors
MsgBox Err.Description & " : " & Err.Source & " : " & Err.SQLState & " : " & Err.Number
Next
cnn1.Close
June 10, 2005 at 12:05 pm
Play with this :
Set reg = reg.NextRecordset
I think that you can access the errors only AFTER the last recordset has been loaded.
June 10, 2005 at 12:09 pm
I tried with that but it continues displaying nothing...
June 10, 2005 at 12:25 pm
it would surely help if I gave you this :
CREATE PROCEDURE [dbo].[SPNTest]
AS
SET NOCOUNT ON
Select Id, Name from dbo.SysObjects order by Name
Print 'Hello World'
RAISERROR (1, 0, 0)
SET NOCOUNT OFF
GO
June 10, 2005 at 12:25 pm
That doesn't work very well.
I can't find a way to capture the err message..
Maybe this will get you started (you'll need to translate to vba) :
Sub test()
On Error GoTo Gestion
Dim MyRs As ADODB.Recordset
Set MyRs = CurrentProject.Connection.Execute("EXEC dbo.SPNTest")
Set MyRs = MyRs.NextRecordset
Set MyRs = Nothing
Exit Sub
Gestion:
MsgBox Err.Description
End Sub
June 10, 2005 at 1:09 pm
Thanks well i must to use a raiserrorr ,well if doesnt exists another option
,but that solve in one way my problem , thank you a lot of
sorry my disturbings .....
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply