Type in another Language in Asp.Net TextBox (Google Transliteration )

Hello,

Some time as per client requirement we need TextBox which support different language.

We can do this by using  Google Transliteration.

use below code to achieve this.







<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>



<!DOCTYPE html>



<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

    

   <script src="https://www.google.com/jsapi" type="text/javascript">

    </script>

    <script language="javascript" type="text/javascript">

        google.load("elements", "1", { packages: "transliteration" });



        function onLoad() {

            var options = {

                //Source Language

                sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,

                // Destination language to Transliterate

                destinationLanguage: [google.elements.transliteration.LanguageCode.HINDI],

                transliterationEnabled: true

            };



            var control = new google.elements.transliteration.TransliterationControl(options);

            control.makeTransliteratable(['txtInput']);



        }

        google.setOnLoadCallback(onLoad);

</script>

</head>

<body>

    <form id="form1" runat="server">

    <div>

    <asp:TextBox id="txtInput" runat="server" style="border: 2px solid Blue; height: 200px; margin-left: auto; width: 600px;" textmode="MultiLine"/>



    </div>

    </form>

</body>



</html>



Below is screen shot of my application..


This code support all the language which support by google..

Let me know in case of query.

Enjoy !!

Posted in | 0 comments

How to find text from all tables of SQL Server (Find Specific Text in All Tables of SQL)

Hello,

Create below store procedure first.




Create PROC SearchInAllTable

(

@searchText nvarchar(max)

)

AS

BEGIN



SET NOCOUNT ON

DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @searchString nvarchar(110)

CREATE TABLE #FinalOutput (ColumnName nvarchar(370), ColumnValue nvarchar(3630))

SET  @TableName = ''

SET @searchString = QUOTENAME('%' + @searchText + '%','''')



WHILE @TableName IS NOT NULL

BEGIN

    SET @ColumnName = ''

    SET @TableName = 

    (

        SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))

        FROM    INFORMATION_SCHEMA.TABLES

        WHERE       TABLE_TYPE = 'BASE TABLE'

            AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName

            AND OBJECTPROPERTY(

                    OBJECT_ID(

                        QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)

                         ), 'IsMSShipped'

                           ) = 0

    )



    WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)

    BEGIN

        SET @ColumnName =

        (

            SELECT MIN(QUOTENAME(COLUMN_NAME))

            FROM    INFORMATION_SCHEMA.COLUMNS

            WHERE       TABLE_SCHEMA    = PARSENAME(@TableName, 2)

                AND TABLE_NAME  = PARSENAME(@TableName, 1)

                AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')

                AND QUOTENAME(COLUMN_NAME) > @ColumnName

        )



        IF @ColumnName IS NOT NULL

        BEGIN

            INSERT INTO #FinalOutput

            EXEC

            (

                'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630) 

                FROM ' + @TableName + ' (NOLOCK) ' +

                ' WHERE ' + @ColumnName + ' LIKE ' + @searchString

            )

        END

    END 

END



SELECT * FROM #FinalOutput

END






Now Run this store procedure from SSMS.




exec SearchInAllTable 'text which need to search'




Enjoy!!!

Posted in | 0 comments