Create, Read, and Detele Cookies in Javascript


Thursday, September 22, 2011

Hello Friends,

This post will explain you how you can create, read and delete the cookies in your webpage using Javascript.

Here is the code to create cookies,
In this below code, you can see, Cookies is Set to Name "RajeshCookie" and value is set to "Rajesh" and
its expire time is set to next month as shown in below code.


//for creating a cookie
<script type="text/javascript">
<!--
   var today = new Date();
   var nextMonth = new Date(today.getYear(), today.getMonth()+1, today.getDate());
   setCookie("RajeshCookie", "Rajesh", nextMonth);
// -->
</script>


Here is the code to read cookies,


//for reading the cookie
<script type="text/javascript">
<!--
      var szName = getCookie("RajeshCookie");
// -->
</script>


Here is the code to Delete cookies,


//for deleting the cookie
<script type="text/javascript">
<!--
      deleteCookie('RajeshCookie');
// -->
</script>


Let me know, if you have any query..




Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com 
 
 


Change ConnectionString when database server is not working




Hello Friends,

Sometime, you might have notice that, your hosting server is working fine but your database is not working due to which you
might be getting error on website and you might be loosing visitor and ranking in website..

This post is regarding that only, you can manage this issue by two database.

You can have two database at different server and you can call this in global.asax

first you can make ping to first database everytime and if its working you can call first server database and
if you find any issue or server is not working then you can switch to second server using below code..



    Dim connStatus As String
        Dim png As New Ping()
        Dim pr As PingReply = png.Send("221.256.357.36")
        connStatus = pr.Status.ToString()
        '--------------------

        If connStatus = "Success" Then
            If ConnString = "OldConnection" Then
                If ConfigurationManager.ConnectionStrings("oldconnection1").ConnectionString <> "" Then
                    ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("oldconnection1").ConnectionString)
                Else
                    Throw New Exception("Connection String is Empty")
                End If
            Else
                If ConfigurationManager.ConnectionStrings("oldconnection2").ConnectionString <> "" Then
                    ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("oldconnection2").ConnectionString)
                Else
                    Throw New Exception("Connection String is Empty")
                End If
            End If
        Else
            If ConnString = "newconnection" Then
                If ConfigurationManager.ConnectionStrings("newconnection1").ConnectionString <> "" Then
                    ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("newconnection1").ConnectionString)
                Else
                    Throw New Exception("Connection String is Empty")
                End If
            Else
                If ConfigurationManager.ConnectionStrings("newconnection2").ConnectionString <> "" Then
                    ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("newconnection2").ConnectionString)
                Else
                    Throw New Exception("Connection String is Empty")
                End If
            End If
        End If


Let me know, if you have any query..




Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com 

SQL Server Query to Search Text in Stored Procedure


Monday, September 12, 2011

Hello Friends,

This post contains one query, by using that you can make search for any text in your Stored
Procedure Or Triggers,

Here is the query..


Use TempDatabase

SELECT ROUTINE_NAME, ROUTINE_DEFINITION 
FROM INFORMATION_SCHEMA.ROUTINES 
WHERE ROUTINE_DEFINITION LIKE '%proc_%' 
AND ROUTINE_TYPE='PROCEDURE'



Frist Select the Database by Use prefix,like below
use TempDatabase

Then copy this query in your query browser of SQL server,

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%proc_%'
AND ROUTINE_TYPE='PROCEDURE'

and just press F5, to run this query

Let me know, if you have any query..



Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com