This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Me And My Respected Teacher Mr Kamal Sheel Mishra

Mr. K.S. Mishra is HOD of Computer Science from SMS Varanasi where I have completed my MCA

Me And My Respected Teacher Mr Udayan Maiti

Mr. Udayan Maiti is a senior .Net Expert and has guided many professionals of multi national Companies(MNC)

Me And My Best Friend Mr Ravinder Goel

Mr. Ravinder Goel is a senior Software Engineer and now he is working Wipro Technology

Wednesday, 6 July 2016

How to save hindi font in MS-Sql Server with Google Api

How to save hindi font in MS-Sql Server with Google Api
 गूगल पी आइ की सहायता डेटाबेस में  हिंदी फॉन्ट कैसे सेव करे

-- Sql Query---------------

create database test
use test
create  table Student_Info
(
RollNo int primary key,
Name nvarchar(50),
StudentInfo nvarchar(50)
)

Note : Column datatype  must be nvarchar type…..

Code for  Default.aspx page……………………………………

<%@ 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>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
height: 23px;
}
</style>

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

// Load the Google Transliterate API
google.load("elements", "1", {
packages: "transliteration"
});

function onLoad() {
var options = {
sourceLanguage:
google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage:
[google.elements.transliteration.LanguageCode.HINDI],
transliterationEnabled: true
};

// Create an instance on TransliterationControl with the required
// options.
var control =
new google.elements.transliteration.TransliterationControl(options);

// Enable transliteration in the textbox with id
// 'transliterateTextarea'.
control.makeTransliteratable(['txtname']);
control.makeTransliteratable(['txtinfo']);
}
google.setOnLoadCallback(onLoad);
</script>

</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td colspan="2">How to save hindi font in MS-Sql Server
<b> डेटाबेस में  हिंदी फॉन्ट कैसे सेव करे </b>
</td>

</tr>
<tr>
<td>RollNo  रोल नंबर</td>
<td>
<asp:TextBox ID="txtrollno" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td> Name (नाम )</td>
<td>
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Student Details(स्टूडेंट विवरण) </td>
<td>
<asp:TextBox ID="txtinfo" runat="server" Height="51px" Width="179px" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<asp:Button ID="btnsave" runat="server" OnClick="Button1_Click" Text="Save" />
<asp:Label ID="lblmessage" runat="server" Text="Label" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style2" colspan="2">
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<div>

</div>
</form>
</body>
</html>

Code for  Default.aspx.cs  page……………………………………

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ShowData();
}

}
SqlConnection con = new SqlConnection("Data Source=ADMIN-PC;Initial Catalog=test;User ID=sa;Password=123");
protected void Button1_Click(object sender, EventArgs e)
{
//string[] lines = Regex.Split(txtinfo.Text, "\r\n");

SqlCommand cmd = new SqlCommand("insert into Student_Info values(@RollNo,@Name,@UserInfo)", con);
cmd.Parameters.AddWithValue("RollNo", Convert.ToInt32(txtrollno.Text));
cmd.Parameters.AddWithValue("@Name", txtname.Text);
cmd.Parameters.AddWithValue("@UserInfo", txtinfo.Text);
if (con.State.ToString() != "Open")
{
con.Open();
}
cmd.ExecuteNonQuery();
con.Close();
lblmessage.Visible = true;
lblmessage.ForeColor = Color.Red;
lblmessage.Text = "Data Saved Successfully";
ShowData();


}

private void ShowData()
{
SqlCommand cmd = new SqlCommand("select * from Student_Info", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();

}
}


Result

Wednesday, 18 May 2016

Mathmatical Function in Sql Sever

Mathmatical Function in Sql Sever:-
  • Abs
  • Ceiling
  • Floor
  • Power
  • Rand
  • Square
  • Sqrt
  • Round
1.Abs (numeric_expressions)- Abs stands for absolute and returns, the absolute (positive) number.
Syntax- select  ABS(numeric_expression)
Ex-
---Abs functions
select ABS(011) ---return 011
select ABS(-101)--return 101 not include minus sign
select ABS(111.1)---return 111.1

2. Ceiling() & Floor() functions:-Ceiling and Floor functions accept a numeric expression as a single parameter . Ceiling () returns a smallest integer value greater than or equal to the parameter, whereas Floor() returns the largest integer less than or eual to the parameter.
Syntax-    select CEILING(numeric_expression)
    select floor(numeric_expression)
Ex- 
·         select CEILING(12.1---returns output 13
·         select CEILING(-12.1---returns output -12
·         select floor(12.1) ---returns output 12
·         select floor(-12.1) ---returns output 13
  
3. Power():-  Returns the power value of the specified expression to the specified power.

Syntax:- select POWER(numeric_expression)
Ex-  select POWER(3,2) ---returns output 9
4. Square():- returns the  square of the given number.
Syntax:-  select SQUARE(numeric_expression)
Ex-  select SQUARE(4)---returns output 16

5. Sqrt():-  Returns the square root of the given number.
Syntax:-  select SQRT(numeric_expression)
Ex-  select SQRT(2)---returns sqareroot output 1.4142135623731


6.Random():- Return the random float number between 0 and 1. Rand() function takes an optional seed parameter. when seed value is supplied the RADN() function always returns the same value for the same seed.

Syntax- select RAND([seed_value])

Ex-  select RAND()---returns always 0 to 1 values but almost 0
select rand(1100)---returns output 0.734069628625685

---if we want 1 to 100 number we use random number:
Ex- select (RAND() * 100--return 0 to 100 (72.1944369495552)

---if we want only integer no float value----
Ex- select floor(RAND() * 100.9)  --return 0 to 100 (72.1944369495552)

7.ROUND() function(numeric_expression, length[function]):- Rounds the given numeric expression based on the given length. This function takes 3 parameters.
  1.  Numeric_Expression-: it’s a number that we want to round.
  2.  Length:- Length parameters, specify the number of the digits that we want to round do. If the length is a positive number, then the rounding is applied to the number before the decimal.
  3. The Optional Function Parameter it used to indicate rounding or truncation operations. 0 indicates rounding , non zero indicates truncation. Default, if it specified is 0.

Ex-:
--if Round 2 places after (to the right)the decimal point
select round(850.556,2)
---output 850.560 (2 decimal values after ignore points indicate 0)
select ROUND(850.556,1)
--output 850.600 (1 decimal values after ignore points indicate 0)
select ROUND(850.556,3)
--output 850.556(3 decimal values after ignore points indicate 0)
--Truncate output 850.556(3 decimal values after ignore points indicate 0)
select ROUND(850.556,1,1)--returns 1 take in left at point side output(850.500)
select ROUND(850.556,2,1)--returns 2 take in left at point side output(850.550)
select ROUND(850.556,3,1)--returns 3 take in left at point side output(850.556)

select ROUND(850.556,-2)---output 850.23260
select ROUND(9069.556,-3)---output 9000.000

select ROUND(850.556,-2)---output 900.000