Monday, May 3, 2010

when running job for sedning mails from SQL 2005 iam getting error like ,Executed as user: admin. INSERT failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods. [SQLSTATE 42000] (Error 1934) Mail queued. [SQLSTATE 01000] (Error 0). The step failed.,00:00:01,16,0,,,,0

This issues can be solved by putting the command SET ARITHABORT ON before you call the SP for sending mail in the scheduler.

SET ARITHABORT ON

Saturday, May 1, 2010

How to Create stored procedure or View in SQL 2005 with encryption?

You can encrypt a view or an SP in SQL server 2005 by using the key work "with encryption" while creating the SP or View.


Please look into the example below.

create procedure MySp with encryption
as
begin
select * from EmailList
end

Once you created an sp or view with the above option added then it cannot be viewed by any users.if the suer tryes to view the above sp orview then it SQL server will show a message like . The text for object 'MySp' is encrypted.

One note of caution. Save the original text of the stored procedure before encrypting it, as there is no straightforward way to decode the encrypted text. One hack is to attach a debugger to the server process and retrieve the decrypted procedure from memory at runtime


Please look to the below link for how to decrypt the encrypted Sp or view.

http://www.sql-shield.com/decrypt-stored-procedure.html

Monday, April 26, 2010

How to hide Validation summary at client side using Java Script?

The below script will help you to hide Validationsummary at client side .

How set focus to a control in a ModalPopupExtender while loading and hiding?(add_shown & add_hiding ModalPopupExtender Events )

In this topic, I’ll discuss the Client events we usually need while using ModalPopupExtender. The add_shown fires when the ModalPopupExtender had shown and add_hiding fires when the user cancels it by CancelControlID,note that it fires before hiding the modal.


They are useful in many cases, for example may you need to set focus to specific Textbox when the user display the modal, or if you need to reset the controls values inside the Modal after it has been hidden.

You can attach your fucntions  by using the Sys.Application.add_load(functionName)
Note :"functionName" should be the name of the function which is used to initialize the events add_hiding and add_shown of the ModalPopupExtender

Inside the fucntion "functionname" you can attach the your functions to the events like below



Please go through the full expample below to understand the woking of these events better.

Sunday, April 25, 2010

How check a constraint with if exixts in sql server 2005?

By using below script you will be able to check the contraint with if exist.

if not exists(SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME='CrmUserHirarchey' AND CONSTRAINT_NAME='FK_CrmUserHirarchey_aUsergroups' ) begin ALTER TABLE [dbo].[CrmUserHirarchey] WITH CHECK ADD CONSTRAINT [FK_CrmUserHirarchey_aUsergroups] FOREIGN KEY([UserGroupID], [CompanyId]) REFERENCES [dbo].[aUsergroups] ([UserGroupID], [CompanyID]) ALTER TABLE [dbo].[CrmUserHirarchey] CHECK CONSTRAINT [FK_CrmUserHirarchey_aUsergroups] end

How to append a double quotes to a string varibale in c# .net (“)?

You can add double quots to a string varibale in C# like below.

Please find below an example, how theses values is passed to a javascript fucntion to show it in message box while chicking on an image.

How to append a double quotes to a string in c# .net (“)?

You can add double quots to a  string in C# like below.
string Name = @"""Helloworld""";

Please find below an example, how theses values is passed to a javascript fucntion to show it in message box while chicking on an image.