Tuesday, March 27, 2012
DPE writing to Event Log
to the Event Log? Writing to the log works fine on my machine in the IDE but
once deployed to the server it fails. I'm assuming its a security issue but
I do not know how to resolve it.
Any help is greatly appreciated.Hi Shawn
Make sure that you've given the correct Code Access Security (CAS)
Permissions to your assembly. If you look up the EventLog.WriteEntry
method, it requires the EventLogPermission. To see how you can add
permission attributes to your custom assembly methods, see
http://msdn2.microsoft.com/en-us/library/ms153587.aspx.
Also, you may need to add extra security attributes to your
AssemblyInfo.cs/vb file. Please review the BOL for Reporting Services
or visit http://msdn2.microsoft.com/en-us/library/ms153561.aspx for
more details.
Regards,
Thiago Silva
MCAD.NET
Shawn wrote:
> Has anyone had success getting a custom data processing extenstion to write
> to the Event Log? Writing to the log works fine on my machine in the IDE but
> once deployed to the server it fails. I'm assuming its a security issue but
> I do not know how to resolve it.
> Any help is greatly appreciated.|||Thanks for the information. I have tried what was suggested and believe that
I am still missing something.
I added the following code group to my config file. As you can see it is
set to "FullTrust".
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="FOCUSCodeGroup"
Description="Code group for my data processing extension">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="D:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting
Services\ReportServer\bin\MyDataExtension.dll"/>
</CodeGroup>
I tried the following two approaches in my assembly:
1)--
EventLogPermission elp = new
EventLogPermission(System.Security.Permissions.PermissionState.Unrestricted);
elp.Assert();
elog.WriteEntry(loc + " -- " + msg, entryType);
2)--
EventLogPermission eventLogPermission = new
EventLogPermission(EventLogPermissionAccess.Administer, ".");
eventLogPermission.PermitOnly();
elog.WriteEntry(loc + " -- " + msg, entryType);
(#2 came from: http://support.microsoft.com/?kbid=918122)
During execution both prompted me for authentication when the exception was
thrown and never wrote to the event log. Any ideas as to what I could still
be missing?|||I was able to resolve the problem by first creating the EventSource on the
server itself. The problem was caused by the creation of the source... NOT
the writing to the log itself. Once the souce was create manually (in the
registry) I was able to write to the log successfully using the
configurations provided earlier. Thanks for the help.
http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/49c3188dba8b7b00/b7240a0183af6cd9?lnk=st&q=asp.net+2.0+eventlog+permission&rnum=10#b7240a0183af6cd9
Monday, March 19, 2012
Doughts in DateDiff
Hi Everybody
when write a sql like this i will get a result like= 3
select datediff(Year,'20041213','20070213')
but when it comes to practical side ,
if the person a person who was born in = 20041213
But the person is actually lived up to 20070213 is nearly 2 years and 3 months ,
so the actual years he live so far is 2 years ! not 3 Years
How to get this results .like i need to get actual years he live so far ?
regards
suis
Hi suis,
There is an article about calculating age of a person at http://www.kodyaz.com/articles/calculate-age-sql-code.aspx including a sql user defined function that you can use in your applications.
I'm also adding here the code for the UDF.
It takes 2 parameters; one for the date of birth and the other is the date which we will calculate the years due to
Code Snippet
CREATE FUNCTION dbo.fn_CalculateAge
(
@.BirthDate datetime,
@.CurrentDate datetime
)
RETURNS int
AS
BEGIN
IF @.BirthDate > @.CurrentDate
RETURN 0
DECLARE @.Age int
SELECT @.Age = DATEDIFF(YY, @.BirthDate, @.CurrentDate) - CASE WHEN( (MONTH(@.BirthDate)*100 + DAY(@.BirthDate)) > (MONTH(@.CurrentDate)*100 + DAY(@.CurrentDate)) ) THEN 1 ELSE 0 END
RETURN @.Age
END
GO
I hope it helps,
Eralper
|||For BOL:
DATEDIFF returns the number of date and time boundaries crossed between two specified dates. In the following example, the first statement returns 1 year. (That is, 2006 - 2005 = 1) The second statement returns 1 month. (That is, Jan 2006 - Dec 2005) The third statement returns 12 as the number of days between the two dates.
SELECT DATEDIFF(year, '20051220', '20060101') SELECT DATEDIFF(month, '20051220', '20060101') SELECT DATEDIFF(day, '20051220', '20060101')|||Hi thanks very much for the helpThese comments helped me lot to sort out my problem
thnaks again
regards
suis
Sunday, March 11, 2012
double clicking a trace file does not bring any results
profiler write to, just opens up Profiler and does not display the saved
results.
But when i go File-> Open and select the trace file, it populates the
results. So I dont know why the double clicking does not populate it ? Is it
a bug ? It used to work when i had Sp3a but after installing Sp4, it acts as
such
Has anyone seen this ?Hassan wrote:
> I installed SP4 and when i double click on a sql trace file that i
> had the profiler write to, just opens up Profiler and does not
> display the saved results.
> But when i go File-> Open and select the trace file, it populates the
> results. So I dont know why the double clicking does not populate it
> ? Is it a bug ? It used to work when i had Sp3a but after installing
> Sp4, it acts as such
> Has anyone seen this ?
I've found that the "Action" created for the TRC files by the installer
does not set this up properly. From Explorer, Click on Tools | Folder
Options - File Types. Locate the TRC file extension in the list. Click
the Advanced button. Click New to create a new action. Call it "Open in
Profiler" with the following properties:
Action: "Open in Profiler"
App used to perform action: "C:\Program Files\Microsoft SQL
Server\80\Tools\Binn\profiler.exe" /F%1
Use DDE: Checked
Application: profiler
Topic: System
Press OK and then click the Set Default button to make this the default
action.
You should be good to go.
David Gugick
Quest Software
www.imceda.com
www.quest.com|||Still the same.. No luck.. :-(
"David Gugick" <david.gugick-nospam@.quest.com> wrote in message
news:%23nXr6wtvFHA.612@.TK2MSFTNGP10.phx.gbl...
> Hassan wrote:
> I've found that the "Action" created for the TRC files by the installer
> does not set this up properly. From Explorer, Click on Tools | Folder
> Options - File Types. Locate the TRC file extension in the list. Click the
> Advanced button. Click New to create a new action. Call it "Open in
> Profiler" with the following properties:
> Action: "Open in Profiler"
> App used to perform action: "C:\Program Files\Microsoft SQL
> Server\80\Tools\Binn\profiler.exe" /F%1
> Use DDE: Checked
> Application: profiler
> Topic: System
> Press OK and then click the Set Default button to make this the default
> action.
> You should be good to go.
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com|||Hassan wrote:
> Still the same.. No luck.. :-(
I use it and it works fine here. Please check the Action against what I
posted to make sure it was typed in correctly. Also make sure it's the
default action. Running SP3a and SP4 versions of SQL Server.
David Gugick
Quest Software
www.imceda.com
www.quest.com
double clicking a trace file does not bring any results
profiler write to, just opens up Profiler and does not display the saved
results.
But when i go File-> Open and select the trace file, it populates the
results. So I dont know why the double clicking does not populate it ? Is it
a bug ? It used to work when i had Sp3a but after installing Sp4, it acts as
such
Has anyone seen this ?Hassan wrote:
> I installed SP4 and when i double click on a sql trace file that i
> had the profiler write to, just opens up Profiler and does not
> display the saved results.
> But when i go File-> Open and select the trace file, it populates the
> results. So I dont know why the double clicking does not populate it
> ? Is it a bug ? It used to work when i had Sp3a but after installing
> Sp4, it acts as such
> Has anyone seen this ?
I've found that the "Action" created for the TRC files by the installer
does not set this up properly. From Explorer, Click on Tools | Folder
Options - File Types. Locate the TRC file extension in the list. Click
the Advanced button. Click New to create a new action. Call it "Open in
Profiler" with the following properties:
Action: "Open in Profiler"
App used to perform action: "C:\Program Files\Microsoft SQL
Server\80\Tools\Binn\profiler.exe" /F%1
Use DDE: Checked
Application: profiler
Topic: System
Press OK and then click the Set Default button to make this the default
action.
You should be good to go.
David Gugick
Quest Software
www.imceda.com
www.quest.com|||Still the same.. No luck.. :-(
"David Gugick" <david.gugick-nospam@.quest.com> wrote in message
news:%23nXr6wtvFHA.612@.TK2MSFTNGP10.phx.gbl...
> Hassan wrote:
>> I installed SP4 and when i double click on a sql trace file that i
>> had the profiler write to, just opens up Profiler and does not
>> display the saved results.
>> But when i go File-> Open and select the trace file, it populates the
>> results. So I dont know why the double clicking does not populate it
>> ? Is it a bug ? It used to work when i had Sp3a but after installing
>> Sp4, it acts as such
>> Has anyone seen this ?
> I've found that the "Action" created for the TRC files by the installer
> does not set this up properly. From Explorer, Click on Tools | Folder
> Options - File Types. Locate the TRC file extension in the list. Click the
> Advanced button. Click New to create a new action. Call it "Open in
> Profiler" with the following properties:
> Action: "Open in Profiler"
> App used to perform action: "C:\Program Files\Microsoft SQL
> Server\80\Tools\Binn\profiler.exe" /F%1
> Use DDE: Checked
> Application: profiler
> Topic: System
> Press OK and then click the Set Default button to make this the default
> action.
> You should be good to go.
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com|||Hassan wrote:
> Still the same.. No luck.. :-(
I use it and it works fine here. Please check the Action against what I
posted to make sure it was typed in correctly. Also make sure it's the
default action. Running SP3a and SP4 versions of SQL Server.
David Gugick
Quest Software
www.imceda.com
www.quest.com
double clicking a trace file does not bring any results
profiler write to, just opens up Profiler and does not display the saved
results.
But when i go File-> Open and select the trace file, it populates the
results. So I dont know why the double clicking does not populate it ? Is it
a bug ? It used to work when i had Sp3a but after installing Sp4, it acts as
such
Has anyone seen this ?
Hassan wrote:
> I installed SP4 and when i double click on a sql trace file that i
> had the profiler write to, just opens up Profiler and does not
> display the saved results.
> But when i go File-> Open and select the trace file, it populates the
> results. So I dont know why the double clicking does not populate it
> ? Is it a bug ? It used to work when i had Sp3a but after installing
> Sp4, it acts as such
> Has anyone seen this ?
I've found that the "Action" created for the TRC files by the installer
does not set this up properly. From Explorer, Click on Tools | Folder
Options - File Types. Locate the TRC file extension in the list. Click
the Advanced button. Click New to create a new action. Call it "Open in
Profiler" with the following properties:
Action: "Open in Profiler"
App used to perform action: "C:\Program Files\Microsoft SQL
Server\80\Tools\Binn\profiler.exe" /F%1
Use DDE: Checked
Application: profiler
Topic: System
Press OK and then click the Set Default button to make this the default
action.
You should be good to go.
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||Still the same.. No luck.. :-(
"David Gugick" <david.gugick-nospam@.quest.com> wrote in message
news:%23nXr6wtvFHA.612@.TK2MSFTNGP10.phx.gbl...
> Hassan wrote:
> I've found that the "Action" created for the TRC files by the installer
> does not set this up properly. From Explorer, Click on Tools | Folder
> Options - File Types. Locate the TRC file extension in the list. Click the
> Advanced button. Click New to create a new action. Call it "Open in
> Profiler" with the following properties:
> Action: "Open in Profiler"
> App used to perform action: "C:\Program Files\Microsoft SQL
> Server\80\Tools\Binn\profiler.exe" /F%1
> Use DDE: Checked
> Application: profiler
> Topic: System
> Press OK and then click the Set Default button to make this the default
> action.
> You should be good to go.
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
|||Hassan wrote:
> Still the same.. No luck.. :-(
I use it and it works fine here. Please check the Action against what I
posted to make sure it was typed in correctly. Also make sure it's the
default action. Running SP3a and SP4 versions of SQL Server.
David Gugick
Quest Software
www.imceda.com
www.quest.com
Wednesday, March 7, 2012
Dont know which database to use for the following site
Just wondered if i could ask you for some advice and help.
I'm looking to write a site, and one of the functions of the site is to remind the user of a certain event at a certain time. I was wondering how i would do this? or if anyone has a working example i could use?
Also I dont quite know what database to use..... would MySQL do the function i am after?? If so then no more problem lol If not what database would you recommend i use?
Thanks
Dannyi recommend mysql
which language are you planning to use? perl? coldfusion? asp?|||do the whole thing in clipper or ada as the front end code.|||Well im looking to do it in perl. But thats not really my skill, but its a good enough time as any to start learning it. I know more asp than anything.
The only issue i have is, the site is hosted on a NAMESCO server that has MYSQL. And as i have never used MYSQL i dont know how to configure it...... not only that, i could probably know how to set it all up if i had some sort of interface to it. But theres nothing.
Probably me having a noob moment, but anyone know what i mean?
Thanks
Dan|||well, you can use asp with mysql as well
your interface to mysql could be one of the mysql utilities available on the mysql site
or you could use Heidi SQL, which is what i use, it's really great
Sunday, February 19, 2012
Doing the same replace on several columns?
Sorry, there is no such feature. Sounds like a good candidate to enter as a suggestion.
Note: it would be possible to write code that programmatically does what you are looking for, by loading a package, finding the derived column transform, getting the input column collection, and setting the expression properties.
Thanks
Mark
I had a similar dilemma with having a good number of my input fields requiring trimming. Following the lead of several custom component examples I got rid of the ProcessInput_Row (I think that's what's in there) and overrode PreExecute and ProcessInput with the following in a Script Componet, of type Transform.
The biggest drawback is having to select all the checkboxes on the Input Columns tab and set them all to ReadWrite, but with some keyboard skills, that can go pretty quickly.
I've not been a programmer in any of my previous lives, so please forgive the poor form:
Public Class ScriptMain
Inherits UserComponent
Private _inputColumnInfos As ColumnInfo()
Public Structure ColumnInfo
Public bufferColumnIndex As Integer
Public lineageID As Integer
End Structure
Public Overrides Sub PreExecute()
Dim input As IDTSInput90 = ComponentMetaData.InputCollection(0)
ReDim _inputColumnInfos(input.InputColumnCollection.Count - 1)
For x As Integer = 0 To (input.InputColumnCollection.Count - 1)
Dim column As IDTSInputColumn90 = input.InputColumnCollection(x)
_inputColumnInfos(x) = New ColumnInfo()
_inputColumnInfos(x).bufferColumnIndex = input.InputColumnCollection.FindObjectIndexByID(column.ID)
_inputColumnInfos(x).lineageID = column.LineageID
Next
MyBase.PreExecute()
End Sub
Public Overrides Sub ProcessInput(ByVal InputID As Integer, ByVal Buffer As Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer)
Dim columnInfo As ColumnInfo
While (Buffer.NextRow())
For x As Integer = 0 To (_inputColumnInfos.Length - 1)
columnInfo = _inputColumnInfos(x)
Dim trxVal As String = Buffer.GetString(columnInfo.bufferColumnIndex).ToString().Trim
Buffer.SetString(columnInfo.bufferColumnIndex, trxVal)
Next
End While
End Sub
End Class