Tuesday 27 August 2013

What is Triggers in SQL Server?

What is Trigger in SQL Server?
A trigger is especial type of Stored Procedure that executes when certain action performed on Table like:-
  • Insert
  • Delete
  • Update

It’s a Database Object which is bound to a table and is executed automatically.

There are Two type of Trigger:-
  • After Trigger(For Trigger)
  • Instead of Trigger


After Trigger are divided into Three type:-
  1. For Insert
  2. For Delete
  3. For Update


Instead of Trigger are divided into Three type:-
  1. Instead of Insert
  2. Instead of Delete
  3. Instead of Update



Monday 26 August 2013

Difference Between LEN and DATALENGTH Functions in SQL Server





LEN:- It shows actual Length of Declared Variable not as it’s Capacity.
Explanation:-

Char(50),Here we declare on Char variable with 50 character capacity .
But we assigned ‘Rahul’ only 5 character.
This Actual Length is called Len of a Variable.

DATALENGTH:- But DATALENGTH  shows the capacity of a Variable.
Char(50) here 50 is the capacity of char Variable.


DECLARE @str 
CHAR(50)

SET @str='Rahul'

SELECT LEN(@str) AS LenCount

SELECT DATALENGTH(@str) AS DataLengthCount











Sunday 25 August 2013

Diffrence b/w Convert.ToString() and .ToString()

Diffrence b/w Convert.ToString() and .ToString()



.ToString()………….
.ToString() does not handle null value.
string s = null;
      
 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "<script> alert('" + s.ToString() + "')</script>", false);

It’s Generates Error as Given Below:-
NullReferenceException was unhandled by user code


Convert.ToString ()

It’s handle null value.
string s = null;
      
 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "<script> alert('" +  Convert.ToString(s) + "')</script>", false);

It does Not  Generates Error







What is the Execution Flow of a SQL QUERY?

What is the flow of Execution of a SQL QUERY?

1.    FROM clause
2.    WHERE clause
3.    GROUP BY clause
4.    HAVING clause
5.    SELECT clause
6.    ORDER BY clause

If we write the sql Query in SQL Editor. The Execution Flow is:   

            First Execute From Clause

                        Then Where Clause

                                    Then Group By Clause            
                                                                                                            
                                                Then Having Clause

                                                            Then Select Clause

                                                                        Order By Clause

Thursday 1 August 2013

How To Convert Text To Voice in WPF

How to  Convert Text To Voice in WPF ….






XAML Design Page

<Window x:Class ="Wpfwithdatabase.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" >
    <Grid Background="#FF7BB8DE">
       
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="133,84,0,0" Name="textBlock1" Text="TextBlock" VerticalAlignment="Top" Width="118" Visibility="Collapsed" />
        <TextBox Height="80" HorizontalAlignment="Left" Margin="123,43,0,0" Name="textBox1" VerticalAlignment="Top" Width="265" BorderBrush="#FF22EE22" Background="#CD335387" Foreground="White" FontWeight="Bold" FontSize="14" />
        <Button Content="Click To Listen Voice" Height="23" HorizontalAlignment="Left" Margin="182,129,0,0" Name="button2" VerticalAlignment="Top" Width="150" Click="button2_Click" Foreground="#FF1E48EA" />
        <Label Content="Enter Text Here" Height="28" HorizontalAlignment="Left" Margin="26,68,0,0" Name="label1" VerticalAlignment="Top" />
    </Grid>
</Window>

Code Page

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Speech.Synthesis;

namespace Wpfwithdatabase
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        // object creation of SpeechSynthesizer Class
        private SpeechSynthesizer voice = new SpeechSynthesizer();
      
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            // Code for select Female Voice
            voice.SelectVoiceByHints(VoiceGender.Female);

            //code for convert text to voice
            voice.SpeakAsync(textBox1.Text);
        }

      
      

      

      

      
    }
}