Posts

Showing posts from August, 2012

Disabling Rightclick on webpage using javascript

JAVA SCRIPT CODE : var message = "Right click testing";         function click(e) {             if (document.all) {                 if (event.button == 2) {                     alert(message);                     return false;                 }             }             if (document.layers) {                 if (e.which == 3) {                     alert(message);                     return false;                 }             }         }         if (document.layers) {             document.captureEvents(Event.MOUSEDOWN);         }         document.onmousedown = click; ASPX CODE Put above code between <Head></Head> tag And Run the script !! On web , try to right click and wait for alert message !!

How to Install IIS 7 and Setup a Static Website ?

Image
Installing IIS 7 on Windows Server 2008 Since the IIS web server is not installed by default, the first thing we have to do is install IIS as a role for the server we are working on. 1. Click on Start -> Administrative Tools -> Server Manager 2. In Server Manager scroll down to Roles Summary , and click on Add Roles 3. The Add Roles Wizard starts at this point and warns you that if you are going to add a role to make sure: The administrator account has a strong password Network settings, such as static IP, are configured The latest security updates from Windows Updates are installed 4. Click Next to go the Add Server Role page. Place a checkmark next to Web Server (IIS) and then click on the button Next 5. The next page will give you some basic information on IIS Web Servers and a few links with extra information if needed. Click on the button Next to continue 6. The next window is the Select Role Services . This very important screen will allow yo

How to copy data from one table to another in oracle / sql server

// Correct Query to copy data from one table to another where column name not same INSERT INTO [TestApp] . [dbo] . [Table_1] SELECT  [table_two_col1] as [table_one_col] , [table_two_col2] as [table_one_col2] , [table_two_col3] as [table_one_col3] FROM [TestApp] . [dbo] . [table_2] // Following query useful for only Copy data from one table to another 2)    INSERT INTO   [TestApp] . [dbo] . [Table_1] VALUES ( SELECT  [table_two_col1] , [table_two_col2], [table_two_col3]  FROM [TestApp] . [dbo] . [table_2] ) 3)  SELECT   [table_two_col1] , [table_two_col2], [table_two_col3] into [TestApp] . [dbo] . [Table_1] FROM [TestApp] . [dbo] . [table_2] Try it... :)

Conversion failed when converting the nvarchar value 'GENERAL' to data type int.

SQL Server Error : Causes :         -       It causes when you are executing query in SQL Server 2008 /2005 or ..            -       Here it may cause because of your query execution or datatype of entity.        -       Ex :  Converting from int to string  or input int but datatype is nvarchar etc Actions :       -       Suppose your data stored in varchar format , then you should use   ' '   single quotationmark for parameters in where conditions.       Example :  Datatype  name nvarchar(50) 1)  Wrong Query :- >     SELECT [emp_no]  from  [emp_MAST] where [shift_cd] = 1; Here shift_cd  = 1 (which is int) bt my ticketNo is nvarchar(50) . So error . 2)   Correct query  :- >      SELECT [emp_no]  from  [emp_MAST] where [shift_cd] = '1'; This is will help you !!

How to print report for multiple employee's ( Ex : For 1000 employee payslip in one report )

Here , If you want one report file for multiple employee or object and with same format ?? it is possible because of crystal reports. Here -  Create crystal report and design as you want and provide schema. -  After creating report from .net , gather all information in DataTable or DataSet . -  Call function or query to DataSet for storing information. -  Make DataSet as datasource for crystal reports. In crystal reports :-> In crystal reports , you need to follow steps as -  Right click on report . In  "Report"  Section click on submenu "Section Expert" - One window will open ,on that window observ  "Section"  Part where you will get "Details"  (3rd option)   Select that. -  After Click on " Details" ,In  Adjcent window multiple checkboxes will appear. - From that checkboxes select "Format Multiple column .. " After that , from "Layout " tab of same section ,Click on "Format Mu

NUMTOYMINTERVAL IN ORACLE

NUMTOYMINTERVAL converts number n to an INTERVAL YEAR TO MONTH literal. The argument n can  be any NUMBER value or an expression that can be implicitly converted to a NUMBER value. The argument interval_unit can be of CHAR , VARCHAR2 , NCHAR , or NVARCHAR2 datatype. The value for interval_unit specifies the unit of n and must resolve to one of the following string values: YEAR ' ' MONTH ' interval_unit is case insensitive. Leading and trailing values within the parentheses are ignored. By default, the precision of the return is 9. Examples The following example calculates, for each employee, the total salary of employees hired in the past one year from his or her hire date. SELECT last_name, hire_date, salary, SUM(salary) OVER (ORDER BY hire_date RANGE NUMTOYMINTERVAL(1,'year') PRECEDING) AS t_sal FROM employees;

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) Causes :  Before i came here i searched every possibilities to fix this error. I followed the correct steps and still shows this error when i am trying to access the website. Actions It was because i was using the default user provided by windows. I've created an SQL user and now is working like a charm You also follow the same.

Common errors in Web.Config of ASP.NET

1. Custom Errors Disabled When you disable custom errors as shown below, ASP.NET provides a detailed error message to clients by default. Wrong configuration: <configuration> <system.web> <customErrors mode="Off"> Right configuration: <configuration> <system.web> <customErrors mode="RemoteOnly"> The more information a hacker can gather about a Web site, the more likely it is that he will be able to successfully attack it. An error message can be of vital significance to an attacker. A default ASP.NET error message lists the specific versions of ASP.NET and the .NET framework which are being used by the Web server, as well as the type of exception that was thrown. Just knowing which Web-based applications are used (in this case ASP.NET) compromises application security by telling the attacker that the server is running a relatively recent version of Microsoft Windows and that Microsoft Internet Information Serv

Web Services in ASP.NET

A Web Service is programmable application logic accessible via standard Web protocols. One of these Web protocols is the Simple Object Access Protocol (SOAP). SOAP is a W3C submitted note (as of May 2000) that uses standards based technologies (XML for data description and HTTP for transport) to encode and transmit application data. Consumers of a Web Service do not need to know anything about the platform, object model, or programming language used to implement the service; they only need to understand how to send and receive SOAP messages (HTTP and XML). Try simple code : ASPX :-> < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="server"> < title ></ title > </ head > < body > < form id ="form1" runat ="server"> < div > < asp : GridView ID ="GridView1" runat ="server"> < Columns > < asp : BoundField DataField ="id" Hea