thanks a lot <big>Eddy Vluggen.</big>
Your really an export in SQL.
I have use this for SP:
declare @TraceId int
exec sp_trace_create @TraceId output, 0, N'C:\Temp\SQLLog'
exec sp_trace_setevent @TraceId, 12, 1, 1
exec sp_trace_setevent @TraceId, 12, 6, 1
exec sp_trace_setevent @TraceId, 13, 1, 1
exec sp_trace_setevent @TraceId, 13, 6, 1
exec sp_trace_setevent @TraceId, 12, 13, 1
exec sp_trace_setevent @TraceId, 12, 10, 1
exec sp_trace_setevent @TraceId, 12, 13, 1
exec sp_trace_setevent @TraceId, 12, 14, 1
exec sp_trace_setevent @TraceId, 12, 15, 1
exec sp_trace_setevent @TraceId, 13, 10, 1
exec sp_trace_setevent @TraceId, 13, 13, 1
exec sp_trace_setevent @TraceId, 13, 14, 1
exec sp_trace_setevent @TraceId, 13, 15, 1
exec sp_trace_setevent @TraceId, 12, 35, 1
exec sp_trace_setevent @TraceId, 13, 35, 1
exec sp_trace_setevent @TraceId, 44, 10, 1
exec sp_trace_setevent @TraceId, 44, 13, 1
exec sp_trace_setevent @TraceId, 44, 14, 1
exec sp_trace_setevent @TraceId, 44, 15, 1
exec sp_trace_setevent @TraceId, 44, 1, 1
exec sp_trace_setevent @TraceId, 44, 6, 1
exec sp_trace_setevent @TraceId, 44, 35, 1
exec sp_trace_setevent @TraceId, 45, 35, 1
exec sp_trace_setevent @TraceId, 45, 10, 1
exec sp_trace_setevent @TraceId, 45, 13, 1
exec sp_trace_setevent @TraceId, 45, 14, 1
exec sp_trace_setevent @TraceId, 45, 15, 1
exec sp_trace_setevent @TraceId, 45, 1, 1
exec sp_trace_setevent @TraceId, 45, 6, 1
exec sp_trace_setstatus @TraceId, 1
select value from fn_trace_getinfo(@TraceId) where property in (2, 5)
go
and in C#
sb = new StringBuilder();
sb.AppendLine("\nEventClass: " + ts.GetString(ts.GetOrdinal("EventClass")));
sb.AppendLine("NTUserName: " + ts.GetString(ts.GetOrdinal("NTUserName")));
sb.AppendLine("Command : " + ts.GetString(ts.GetOrdinal("TextData")));
I have done about 90 percent:
but when i run any SP in SQL Management it returns exactly the SP witch have exec in LOG like bellow :
INSERT INTO tblGroups
(GroupName, GroupFatherId)
VALUES ('Friends',1)
OR
DECLARE @return_value int
EXEC @return_value = [dbo].[InsertGroups]
@GroupName = N'ali joon',
@GroupFatherId = 1
SELECT 'Return Value' = @return_value
But when i run SP in C# it only return the <big>SP Code</big> .like bellow:
INSERT INTO tblGroups
(GroupName, GroupFatherId)
VALUES (@GroupName,@GroupFatherId)
<big>But i wanna to have this also :</big>
INSERT INTO tblGroups
(GroupName, GroupFatherId)
VALUES ('Friends',1)
OR
DECLARE @return_value int
EXEC @return_value = [dbo].[InsertGroups]
@GroupName = N'ali joon',
@GroupFatherId = 1
SELECT 'Return Value' = @return_value
modified 14-May-12 3:51am.
|