Sunday, 10 November 2013

How can we delete duplicate duplicate information in sql server

DELETE
FROM  sheet1$
WHERE sheet1$.%%lockres%%
      NOT IN (SELECT MIN(b.%%lockres%%)
              FROM   sheet1$ b
              GROUP BY b.candidatecode, b.candidatename, b.currentyrsem, b.stream, b.streamsubject, b.subject, b.subjectcode, b.subjecttype, b.theorymarks, b.iamarks, b.theoryminmarks, b.theorymaxmarks, b.iaminmarks, b.iamaxmarks, b.credits, b.centername, b.result, b.collaboratorname)
             

Sheet1$ is a table name and candidatecode, candidatename, currentrysem, stream and all are the coloumn name of table......

Tuesday, 9 July 2013

How can we play .mp3 songs in asp.net


<object width="600" height="400">
            <param name="Music1" value="MusicFileName">
            <embed src="20 Haavan Mix - Kenny G.mp3" width="600" height="500" loop="true">
            </embed>
        </object>


I hope this code will help you...

Monday, 1 October 2012

How can we convert text to voice in asp.net

Use these namespaces:-

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SpeechLib;
 
Follow the step to add library reference:- 
Add Reference-----> 
COM---> MicrosoftSpeechObjectLibrary (Add this reference).
 
 

Friday, 28 September 2012

Attractive drop down menu using css

Write Down The Code

    <div id="content-wrapper">
  <ul id="hb-menu">
<li><a href="#">Home</a></li>
<li>
<a href="#">Categories</a>
<ul>
<li><a href="#">CSS</a></li>
<li><a href="#">Graphic design</a><ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
</ul>   </li>

Thursday, 27 September 2012

how can we upload and download file in asp.net

Code of upload/insert data in database:- 
 
protected void imgSubmit_Click(object sender, ImageClickEventArgs e)
    {
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["con"].ToString());
        SqlCommand cmd = new SqlCommand("application", con);
        cmd.Connection = con;
        cmd.CommandType = CommandType.StoredProcedure;

        if (filephoto.HasFile && filedoc1.HasFile && filedoc2.HasFile && filedoc3.HasFile)
        {
            string fileExt = System.IO.Path.GetExtension(filephoto.FileName);

Friday, 21 September 2012

How can we validate .doc,.docx file using javascript

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function validate() {
var uploadcontrol = document.getElementById('<%=FileUpload3.ClientID%>').value;
//Regular Expression for fileupload control.
var reg = /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.doc|.docx|.DOC|.DOCX)$/;
if (uploadcontrol.length > 0)
{
//Checks with the control value.
if (reg.test(uploadcontrol))
{
return true;
}

Saturday, 8 September 2012

How can we select all check box in one click using javascript

<HeaderTemplate>
  <input id="chkAll"  
onclick="javascript:SelectchooseAllCheckboxes(this);" 
              runat="server" type="checkbox" />
</HeaderTemplate> 
 

Saturday, 9 June 2012

Important Functions used in sql server 2008/2005

The TOP Clause

The TOP clause is used to specify the number of records to return.
The TOP clause can be very useful on large tables with thousands of records. Returning a large number of records can impact on performance.

 Syntax

SELECT TOP number|percent column_name(s)
FROM table_name

Monday, 4 June 2012

How dll hell problem solve in .net

Dll Hell refers to a set of problems caused when multiple 
applications attempt to share a common component like a 
dynamic link library (DLL). The reason for this issue was 
that the version information about the different components 
of an application was not recorded by the system. 

Main Difference between C#3.0 vs c#4.0

C# 4.0
C# 3.5
C# 4.0 supports dynamic programming through dynamic objects.
C# 3.5 does not support dynamic programming.
In C# 4.0, dynamic keyword is associated with objects to represent them as dynamic objects.
The dynamic keyword is not recognized in C# 3.5.
C# 4.0 allows creation of dynamic variables.
Dynamic variables cannot be created in C# 3.5.
In C# 4.0, the method parameters can be specified with default values using optional parameters.
In C# 3.5, method parameters cannot be specified with default values. C# 3.5 does not support optional parameters.
C# 4.0 provides named parameters to represent the values of method parameters without following the order of declaration.
In C# 3.5, method parameters have to be specified in the same order as in method declaration in the method call. C# 3.5 does not provide named parameters.
In C# 4.0, usage of ref keyword is optional while executing methods which are supplied by the COM interfaces.
In C# 3.5, usage of ref keyword is mandatory while executing methods which are supplied by the COM interfaces.
The COM object’s indexed properties are recognized in C# 4.0.
The COM object’s indexed properties are not recognized in C# 3.5.
C# 4.0 enhances Generics by introducing co-variance and contra-variance.
Co-variance and contra-variance are not supported in Generics of C# 3.5.

Friday, 1 June 2012

How can we make calculator in vb.net

 This is the simple code of calculator:-

Public Class Form2
    Dim total1 As Integer
    Dim total2 As Integer
    Dim sign As String
    Dim opr As String

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = TextBox1.Text & "0"
    End Sub

Difference between primitive type and non primitive data type in C#

There are two types of data type in C#

primitive data types are the datatypes which are not objects as they are present in c and c++. eg.int,char,float etc.
where as non primitive are the datatypes which are considered as objects eg. String.
This is one of the reason why java is not a purely object oriented lang as the primitive data types are also allowed in java

Thursday, 31 May 2012

practical interview questions of c#



Q. Write a program in C# that take string input, and print its number of characters.

string name = Console.ReadLine();
Console.WriteLine(name.Length);
Console.ReadLine();

Q. Write a program in C Sharp that take a sentense as input, and show the number of "a" used in the sentense.

string name = Console.ReadLine();
int counter = 0;
for (int i = 0; i < name.Length; i++)
{
if (name[i] == 'a')
{
counter++;
}

Saturday, 19 May 2012

Program of palindrome in c#

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args) {
string str=string .Empty ;
Console.WriteLine("Enter a String name");
string s = Console.ReadLine();
int i = s.Length;
//we can get the Length of string by using Length Property

Friday, 18 May 2012

Main difference between web user control & custom control in asp.net

This is from Microsoft's site:
Web user controls
  • Easier to create
  • Limited support for consumers who use a visual design tool
  • A separate copy of the control is required in each application
  • Cannot be added to the Toolbox in Visual Studio
  • Good for static layout

Thursday, 17 May 2012

In C# Reverse String Program

public string reverse(string str)
{

int len=str.length;
Char[] arr=new Char[len];
for(int i=0;i<len;i++)
{
  arr[i]= str[len-1-i];
 }

In C# Reverse program of number

int n = 1234567;
int left = n;
int rev = 0;
while(left>0)
{
  r = left % 10;  
  rev = rev * 10 + r;
  left = left / 10; 
}

Console.WriteLine(rev);

Monday, 16 April 2012

How can we send encypted data using querystring in asp.net

We usually pass value through query string of the page and then this value is pulled from Request object in another page.

FirstForm.aspx.cs

Response.Redirect(“SecondForm.aspx?item1=” + TextBox1.Text);

SecondForm.aspx.cs

TextBox1.Text = Request. QueryString["item1"].ToString();

After Encryption Send data using query string in asp.net

Sunday, 8 April 2012

Tuesday, 3 April 2012

How can we implement for and foreach loop in c#

For Loop:-

  int[] myname = new int[1];
        int count = 0;
        for (int i = 0; i < myname.Length; i++)
        {
            count += myname[i];
        }