.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

(Encryption related) Need help making this work.....

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :Sql Server

When I run this statement:

 update SecretData 
  set mySecretData=
      convert(char(3), round(999-899*rand(),0))
   WHERE myID = 1

the value returned in the mySecretData field is always the same. It's like the rand() function is evalued one time and that single result used repeatedly in the query.

1. How can I code this statement to return "random" values to encrypt?

2.  I thought the t-sql encryption functions were non-deterministic, so if rand() did return a single value that was repeatedly used, I'd still expect the mySecretData field to contain different values. But it doesn't.  I'm puzzled.





View Complete Post

More Related Resource Links

SQL Server and MapPoint: Making MapPoint 2010 and SQL Server Spatial Work Together

While SQL Server is a good repository for geospatial data, it doesn't communicate with MapPoint as well as it could. So our geo-data experts show you how to read point and polygon objects from SQL Server and render them in MapPoint and how to write points and polygons back to SQL Server using Entity Framework 4.0 included with Visual Studio 2010.Eric Frost, Richard MarsdenMSDN Magazine September 2010

making page work after DB update in Form View

I could really use some help with this issue. I have a DropDown that allows the selection of a Category Code. The selection populates a Gridview with details of records matching the Category Code. I have only enabled the Select option on the Gridview, which when clicked populates a Formview in Edit Mode with the full record information. When editing is complete and the Update link is clicked, I can not get the page to properly reload/postback. When another Category Code is selected from the Drop Down the Gridview does not report a list of records.   Any help would be greatly appreciated.   Thanks,              

Making Claims based authentication work with multi-tenant environment in SP 2010


Does anybody know of a guide or reference for setting up hosting in a multi tenant where authentication happens in claims based mode?


We have a setup where our clients are hosted on a single web application under different site collections. And we use forms authentication where user of a particular site collection gets authentication using the respective database. We now want to use claims based authentication and out-of-the-box multi-tenancy of SP 2010. We can setup site collections and site groups, but how do we implement claims based authentication in an env like this?

Trouble making collection page work "/


 //CollectionPager1.DataSource = empresasBLL.Find(a => a.ID_EMPRESA.Equals(1)).ToList();
            //CollectionPager1.BindToControl = dtlEmpresas;
            //dtlEmpresas.DataSource = CollectionPager1.DataSourcePaged;

Hello I´m using this code to make the collectionPage work with the datalist.

but when I run the application it dissapears with the data.

does anyone know what I´m doing wrong?


Making a link work in a JS function



I'm new to jQuery, but learning fast, and loving the new functionality!
I'm using a Flash upload component that all works fine, and once it's complete (file uploaded) it calls the following function:
function EAFlashUpload_onResizedImagesUploadEnd() {

Making Ajax Callbacks to the Server Using jQuery with ASP.NET

In the first part of this article series I introduced jQuery's functionality and how it provides a rich client side programming model. This time around I'll expand on these concepts and show you how you can use jQuery in combination with ASP.NET using it as an AJAX backend to retrieve data. I'll also discuss how you can create ASP.NET controls and otherwise interact with jQuery content from ASP.NET pages in WebForms.

jQuery is just a JavaScript library so it will work seamlessly with ASP.NET both from page code as well as through backend driven code using the Page.ClientScript object or ScriptManager. You can use jQuery on its own as a client side and Ajax library that communicates with ASP.NET or you can use jQuery in combination with ASP.NET AJAX. The two actually complement each other quite well as jQuery provides functionality that the ASP.NET AJAX library does not and vice versa. For the most part the interaction between the two libraries is trouble free except for a few very rare edge cases.

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Display Related Data in an ASP.NET GridView

Typically when you display a datagrid you will want to show data from a related table. There are 3 different ways to accomplish this with NetTiers. You can use a custom stored procedure, deepload functionality from the code behind, or a strongly typed datasource control. We'll provide an example of each

Making Sense of ASP.NET Paths

ASP.Net includes quite a plethora of properties to retrieve path information about the current request, control and application. There's a ton of information available about paths on the Request object, some of it appearing to overlap and some of it buried several levels down, and it can be confusing to find just the right path that you are looking for.

Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



Looking for guidance: wanting to work with AJAX architecture



I'm starting a small website that will be backed by a database, and will allow a small number of users to authenticate and select an entry in the database, and then view (and optionally update) a corresponding entry (think master-detail).

I have some flexibility in how I'll do this, but I'd really like to incorperate some newer AJAX style coding, eliminating some page postbacks. I think this is a great opportunity to learn the concepts well.

I'll probably go with an ASP.NET 4.0 site. From what I've seen there are MANY ways to go about this:

-WCF Data Services to expose the data, and consume in ASP.NET

-Page methods to expose the data, separate method to update the data

-I'd rather avoid the UpdatePanel because I'm really looking for a full hands-on approach, with learning client side scripting being an objective as well.

Beyond that, it seems that one can use jQuery to build clientside templates, but also one can use the ASP.NET AJAX template engine (in ASP.NET 4.0 I believe).

A concern I have: users should only be able to work with the data exposed via these endpoints if they are logged into the website. Hopefully I can somehow reuse the ASP.NET forms authentication cookie for this purpose. 

Well, I hope I've posted enough to a

animate effect work but the render items are messed up.


Hi all,

     I have a very unique problem, humm i think. I am using a jquery effect that animate bounce effect, i have a line in my javascript pageLoad function $("#UserBrowserInfoDIV").show('bounce'); - the effects run smoothly but what it does is mess up the bolded text in the div. I have try the items inside the div without bolding and it works fine and no render problem but when bolded the text that are bolded is quite messed up, and barely readable.

Please let me know is there anything else i can do i really would like use this effect.

P.S all the effect have the same render problem, and i am using ie8 under compatibility mode.





Why getTreeNode does not work?



I try to run a  treeview example from msdn:


I also want to use code from


Here is my code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register TagPrefix="mytree"
Assembly="Microsoft.Web.UI.WebControls" %>
 <script type="text/javascript" language="javascript">

     function xxx() {

         var myNode = treeview_one.getTreeNode(treeview_one.selectedNodeIndex);


<form id="myform" runat="server">
<mytree:treeview id="treeview_one"  runat="server" Child

View State Encryption


Hi All,

Why is it that I see the same hash value generated when I use different algorithms for viewstate encryption. I have added below lines to the web.config file

<pages viewstateEncryptionMode="Always"

Category attribute of user control property does not work correctly in categories tab.



I have a User Control (ascx) and a property which a want to display in my categories tab in Visual Studio in the category named "Styles".

[Category("Styles"), DefaultValue(""), Description("The value for formating something.")]
public String MyFormatProperty
set { /* the code for set */; }
get { /* the code for get */; }

And here is the problem: Actually I do not need a get, because I only have to set the property (write only property). But when I omit the get, the property is displayed in the "Misc" category in the categories tab in Visual Studio. Only when I code the get as well, then the property is displayed correctly in the "Styles" category in the categories tab in Visual Studio.

Does anybody know why? How can I display the category correctly only with set?

Thanks, S.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend