Thursday, 31 May 2012

Read text file from JavaScript


Read Text file from JavaScript :

function read() {
      var txtFile = new XMLHttpRequest();
       txtFile.open("GET", "http://localhost:9122/Text.txt", true);
           
       txtFile.onreadystatechange = function () {
        if (txtFile.readyState == 4) {  // Makes sure the document is ready to parse.
          if (txtFile.status == 200) {  // Makes sure it's found the file.
             document.getElementById("div").innerHTML = txtFile.responseText;                       
           }
         }
       }
       txtFile.send(null);
  }

HTML :

<
body onload="read();">
    <form id="form1" runat="server">
    <div id="div">
   
    </div>
    </form>
</body>

Why should be a fan as you are a star of tomorrow

Tuesday, 29 May 2012

Important quries in Sql Server


Get Detail of Trigger in DataBase :

SELECT * FROM SYS.OBJECTS WHERE TYPE_DESC = 'SQL_TRIGGER'

Get Detail of TABLES in DataBase :

SELECT * FROM SYS.OBJECTS WHERE TYPE_DESC = 'USER_TABLE'

Get Detail of SPs in DataBase :

SELECT * FROM SYS.OBJECTS WHERE TYPE_DESC = 'SQL_STORED_PROCEDURE'

Get Detail of View in DataBase :

SELECT * FROM SYS.OBJECTS WHERE TYPE_DESC = 'VIEW'

Get Detail of Scalar function in DataBase :

SELECT * FROM SYS.OBJECTS WHERE TYPE_DESC = 'SQL_SCALAR_FUNCTION'

Get Detail of table valued function in DataBase :

SELECT * FROM SYS.OBJECTS WHERE TYPE_DESC = 'SQL_TABLE_VALUED_FUNCTION'

SET NOCOUNT in SQL SERVER


When SET NOCOUNT is ON, the count is not returned. When SET NOCOUNT is OFF, the count is returned.

The
@@ROWCOUNT function is updated even when SET NOCOUNT is ON.
SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, or for procedures that contain Transact-SQL loops, setting SET NOCOUNT to ON can provide a significant performance boost, because network traffic is greatly reduced.

The setting specified by SET NOCOUNT is in effect at execute or run time and not at parse time.

e.g

When

SET NOCOUNT ON
SELECT
TOP 10 * FROM Product_Master
SELECT @@ROWCOUNT
Then message will display like:
Command(s) completed successfully.
--------------------------------------
When

SET NOCOUNT OFF
SELECT TOP 10 * FROM Product_Master
SELECT @@ROWCOUNT
Then message will display like :
(10 row(s) affected)

(1 row(s) affected)

Saturday, 26 May 2012

Call web Services Using SOAP Client in JavaScript


Call web service using SOAP Client in JavaScript :

function webService() {
            try {

                var myvar = new SOAPClientParameters();
                SOAPClient.invoke( '../Sample.asmx(URL of Service)', 'Hello',
                                              myvar,  true,  Refresh(Callback function) );
            }
            catch (ex) {
                alert(ex)
            }
        }
        function Refresh(r) {
            for (i = 0; i < r.length; i++) {
                document.getElementById("me").innerHTML += "<br />" + r[i].FirstName;
            }
        }

Download  SOAP Client JS File from here
  
Why should be a fan as you are a star of tomorrow