Thursday, 16 May 2013

Change the mouse cursor shape style


<!-- this script got from www.javascriptfreecode.com coded by: Krishna Eydatoula-->

<style>body{cursor:url("Choose your mouse cursor");}</style>

<font face="Tahoma"><a target="_blank" href="http://www.javascriptfreecode.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>

Change status bar moving mouse on picture


<!-- this script got from www.javascriptfreecode.com-Coded by: Krishna Eydatoula -->

<!-- This displays 'Your Message Here' in the status bar when the mouse -->
<!--    pointer is over the 'Put Image Here' image -->

<CENTER>
<A HREF="URL"  onMouseOver="window.status='Your Message Here'; return true"
onMouseOut="window.status=''">
<P><IMG SRC="Put Image Here"></A>
</CENTER>

<!-- This displays 'Your Message Here' in the status bar when the mouse -->
<!--    pointer is over the 'Put Image Here' image -->

<CENTER>
<A HREF="URL"  onMouseOver="window.status='Your Message Here'; return true"
onMouseOut="window.status=''">
<P><IMG SRC="Put Image Here"></A>
</CENTER>


<font face="Tahoma"><a target="_blank" href="http://www.javascriptfreecode.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>

Automatically maximize window


<!-- this script got from www.javascriptfreecode.com-Coded by: Krishna Eydatoula -->

<!-- START OF Window Auto Maximize DHTML -->


<!-- SUMMARY BRIEF

This code will automatically maximize the
browser window when the page is loaded.

-->


<!-- Put this code inside of your <HEAD> tag. -->


<script language="JavaScript1.2">
<!--

top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}

//-->
</script>


<!-- END OF Window Auto Maximize DHTML -->
<font face="Tahoma"><a target="_blank" href="http://www.javascriptfreecode.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>

ASp.Net Menu with css


<%@ Page Language="C#" %>
<!DOCTYPE 
html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" >
<head id=
"Head1" runat="server">
    <style type="text/css">
        .staticMenuItem
        {
            color:black;
            border:solid 1px black;
            padding:2px 4px;
        }
        .menuHover
        {
            color:white;
            background-color:blue;
        }
        .dynamicMenuItem
        {
            color:black;
            padding:2px 4px;       
        }
        .dynamicMenu
        {
            border:Solid 1px black;
            filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color='gray', Positive='true')" 
        }
    </style>
    <title>Menu Desktop</title>
</head>
<
body>
    <form id="form1" runat="server">
    <div>
    
    <asp:Menu
        id="Menu1"
        Orientation="Horizontal"
        StaticMenuItemStyle-CssClass="staticMenuItem"
        StaticHoverStyle-CssClass="menuHover"
        DynamicHoverStyle-CssClass="menuHover"
        DynamicMenuItemStyle-CssClass="dynamicMenuItem"
        DynamicMenuStyle-CssClass="dynamicMenu"
        Runat="server">
        <Items>
        <asp:MenuItem 
            Text="File"
            Selectable="false">
            <asp:MenuItem 
                Text="Save" />
            <asp:MenuItem 
                Text="Open" />
        </asp:MenuItem>    
        <asp:MenuItem 
            Text="Format"
            Selectable="false">
            <asp:MenuItem 
                Text="Bold" 
                ImageUrl="MenuImages/Bold.gif" />
            <asp:MenuItem 
                Text="Italic" 
                ImageUrl="MenuImages/Italic.gif" />
            <asp:MenuItem 
                Text="Underline"
                ImageUrl="MenuImages/Underline.gif"
                SeparatorImageUrl="Images/Divider.gif" />
            <asp:MenuItem
                Text="Left Align" 
                ImageUrl="MenuImages/JustifyLeft.gif" />
            <asp:MenuItem
                Text="Center Align" 
                ImageUrl="MenuImages/JustifyCenter.gif" />            
            <asp:MenuItem
                Text="Right Align"
                ImageUrl="MenuImages/JustifyRight.gif" />                
        </asp:MenuItem>    
        </Items>
    </asp:Menu>    
    
    </div>
    </form>
</
body>
</
html>

           
       

Read Write premission on sql server database


Making a SQL Server Database Read-Only
There are many situations where it is important that users are unable to modify the contents of a database. For example, if data is to be migrated to another server or for reporting purposes. This tip explains how to set a database to a read-only mode.
ALTER DATABASE Command
The ALTER DATABASE command allows a database administrator to modify SQL Server databases and their files and filegroups. This includes permitting the changing of database configuration options.
Setting a Database to Read-Only
When you need to ensure that the data is a database is not modified by any users or automated processes, it is useful to set the database into a read-only mode. Once read-only, the data can be read normally but any attempts to create, updated or delete table rows is disallowed. This makes the read-only mode ideal when preparing for data migration, performing data integrity checking or when the data is only required for historical reporting purposes.
To make a database read-only, the following command is used:
ALTER DATABASE database-name SET READ_ONLY
Setting a Database to Read-Write
If the read-only requirements for the database are temporary, you will need to reset the configuration option following any procedures undertaken. This is achieved with a small modification to the ALTER DATABASE statement to indicate that the database should return to a writeable mode.
ALTER DATABASE database-name SET READ_WRITE

Thursday, 18 April 2013

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.


I had this error and it wasn't related with the DB constrains (at least in my case). I have an .xsd file with a GetRecord query that returns a group of records. One of the columns of that table was "nvarchar(512)" and in the middle of the project I needed to changed it to "nvarchar(MAX)".
Everything worked fine until the user entered more than 512 on that field and we begin to get the famous error message "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."
Solution: Check all the MaxLength property of the columns in your DataTable.
The column that I changed from "nvarchar(512)" to "nvarchar(MAX)" still had the 512 value on the MaxLength property so I changed to "-1" and it works!!.


so finally just set the max length of every field and it will be solved

Israr Ali

Monday, 3 December 2012

Replace function in sql server


The Replace function in SQL is used to update the content of a string. The function call is REPLACE() for MySQL, Oracle, and SQL Server. The syntax of the Replace function is:

Replace(str1, str2, str3): In str1, find where str2 occurs, and replace it with str3.

Assume we have the following table:

Table Geography region_name store_name
East Boston
East New York
West Los Angeles
West San Diego


If we apply the following Replace function:

SELECT REPLACE(region_name, 'ast', 'astern')
FROM Geography;

Result: region_name
Eastern
Eastern
West
West