Tuesday 29 March 2016

Access denied; you need the SUPER privilege for this operation

Access denied; you need the SUPER privilege for this operation





ERROR 

This Stored Procedure  used to only on Localhost

CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_delete_course`(In eid INT)
BEGIN
delete  from `courses` where courseid=eid;
END


REMOVE

DEFINER=`root`@`localhost`


Working Query 

This Stored Procedure  used to only on Server Side

CREATE  PROCEDURE `sp_delete_course`(In eid INT)
BEGIN
delete  from `courses` where courseid=eid;
END



Before Uploading to the Server 
 Clear DEFINER=`root`@`localhost` than working fine





Thursday 24 March 2016

Complete Comparison for VB.NET and C#

1 comment    
categories: , , ,

Complete Comparison for VB.NET and C#


Visual Basic [.NET] (VB.NET) is a multi-paradigm, high-level programming language, implemented on the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language.


C# (pronounced "C-sharp") is an object-oriented programming language from Microsoft that aims to combine the computing power of C++ with the programming ease of Visual Basic. C# is based on C++ and contains features similar to those of Java. C# is designed to work with Microsoft's .Net platform.

VB.Net Namespace


Imports System.Data
Imports System.Data.SqlClient
Imports System.IO


C# Namespace


using System.Data;
using System.Data.SqlClient;
using System.IO;


VB.NET Page Load 

Protected Sub Page_Load(sender As Object, e As EventArgsHandles Me.Load
      
    End Sub


C# Page Load 


protected void Page_Load(object sender, EventArgs e)
    {     

    }


VB.NET Varibles


Dim str As String
str = "VB.NET"
  
Dim cmd As SqlCommand = New SqlCommand()
Dim con As SqlConnection = New SqlConnection()


C# Varibles

SqlCommand cmd = new SqlCommand();
SqlConnection con = new SqlConnection();
string str="";
str="C#";


VB.NET Database ConnectionString


Dim con As SqlConnection = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("dbcon").ConnectionString)
       
con.Open()


C# Database ConnectionString


SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dbcon"].ToString());

        con.Open();


VB.NET If Condition

 Dim s As String = "VB.NET"
        If s = "VB.NET" Then
            Response.Write("Success")
        Else
            Response.Write("Not Success")
        End If


C# If Condition


string s = "C#";
        if (s == "C#")
        { 
            Response.Write("Success");
        }
        else
        {
            Response.Write("Not Success");
        }


VB.NET Function/Methods


Public Sub bind()

    End Sub

Protected Sub bind()

    End Sub

Private Sub bind()

    End Sub


C# Function/Methods

Public void bind()
{
}
Protected void bind()
{
}
Private void bind()
{
} 

VB.NET  WebForm Call

        Response.Redirect("Login.aspx")

C#  WebForm Call



        Response.Redirect("Login.aspx");

VB.NET Image Upload to Server Folder

Dim imgname As String = FileUpload1.PostedFile.FileName

            FileUpload1.SaveAs(Server.MapPath("img/" + imgname))


 C# Image Upload to Server Folder

 String imgname = FileUpload1.PostedFile.FileName;

            FileUpload1.SaveAs(Server.MapPath("img/" + imgname));

VB.NET Access Session

            lbtUsername.Text = Session("username").ToString()

C# Access Session


      lbtUsername.Text = Session["username"].ToString();


VB.NET Access Gridview Events


Protected Sub Button1_Click(sender As Object, e As EventArgs)

        Dim btn As Button = CType(sender, Button)
        Dim row As GridViewRow = CType(btn.NamingContainer, GridViewRow)
        Dim lblAmount1 As String = DirectCast(row.FindControl("Label2"), Label).Text   
    
    End Sub

// Gridview events

        Dim lblid As String = DirectCast(GridView22.Rows(e.RowIndex).FindControl("Label2"), Label).Text


C# Access GridView Events

protected void Button1_Click(object sender, EventArgs e)
    {
        Button btn = (Button)sender;
        GridViewRow row = (GridViewRow)btn.NamingContainer;
        Label lblAmount1 = (Label)row.FindControl("Label2");
    }

 // Gridview events

Label lblid = (Label)GridView1.Rows[e.RowIndex].FindControl("Label2");





Textbox TextMode Property Date and DateTimeLocal Using Asp.Net c#

Textbox TextMode Property Date and DateTimeLocal

We need date and datetime use in the Textbox add TextMode =Date or DateTimeLocal in the Textbox property.

                                   DEMO
                                                                                             



HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
    <table><tr><td>
        <asp:Label ID="Label1" runat="server" Text="Date"></asp:Label>
        </td><td>
            <asp:TextBox ID="txtDate" runat="server" TextMode="Date"></asp:TextBox>
        </td></tr>
        <tr><td>
            <asp:Label ID="Label2" runat="server" Text="DateTimeLocal"></asp:Label>
            </td><td>
                <asp:TextBox ID="txtDateLocal" runat="server" TextMode="DateTimeLocal"></asp:TextBox>
            </td></tr>
        <tr><td></td><td>
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Select" />
            </td></tr>
    </table>
    </div>
    </form>
</body>
</html>


C# CODING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Date_DateTime : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DateTime date1, datetime1;

        date1 = Convert.ToDateTime(txtDate.Text);

        datetime1 = Convert.ToDateTime(txtDateLocal.Text);

  Response.Write("<script>alert('" + "Date with Time =" + datetime1.ToString("dd/MM/yyyy hh:mm tt") + "  Date =" + date1.ToString("dd/MM/yyyy") + "')</script>");

    }
}




Add new Webform - add two textbox change property textmode="Date" and "DateTimeLocal"







Add cs file - Textbox selected date convert to DateTime  and get date format 










Supported Browsers


TextModeNot CompatibleCompatible

DateIE(6,7,8,9,10), FirefoxChrome, Safari, Opera
DateTimeLocalIE(6,7,8,9,10), FirefoxChrome, Safari, Opera



TextMode = "Week" 
<asp:TextBox ID="TextBox1" runat="server" TextMode="Week"></asp:TextBox>


TextModeNot CompatibleCompatible
WeekIE(6,7,8,9,10), FirefoxChrome, Safari, Opera

TextMode = "Color" 

<asp:TextBox ID="TextBox1" runat="server" TextMode="Color"></asp:TextBox>

TextModeNot CompatibleCompatible
ColorIE(6,7,8,9,10), Firefox(Lower Version), SafariChrome, Firefox(Version 29.0.) and Opera

TextMode = "Email" 

<asp:TextBox ID="TextBox1" runat="server" TextMode="Email"></asp:TextBox>



TextModeNot CompatibleCompatible
EmailIE(6,7,8,9), Firefox(Lower Version), SafariIE 10,11,Chrome, Firefox(29), Opera

TextMode = "Month" 

<asp:TextBox ID="TextBox1" runat="server" TextMode="Month"></asp:TextBox>

TextModeNot CompatibleCompatible
MonthIE(6,7,8,9,10), FirefoxChrome, Safari, Opera

TextMode = "Number"
<asp:TextBox ID="TextBox1" runat="server" TextMode="Number"></asp:TextBox>


TextModeNot CompatibleCompatible
NumberIE(6,7,8,9,10), FirefoxChrome, Firefox(29), Safari, Opera

TextMode = "Range" 


<asp:TextBox ID="TextBox1" runat="server" TextMode="Range"></asp:TextBox>


TextModeNot CompatibleCompatible
RangeIE(6,7,8,9), FirefoxIE 10,11, Chrome, Firefox(29), Safari, Opera

TextMode = "Search"

<asp:TextBox ID="TextBox1" runat="server" TextMode="Search"></asp:TextBox>



TextModeNot CompatibleCompatible
SearchIE(6,7,8,9), FirefoxIE 10,11, Chrome, Safari

TextMode = "Time" 

<asp:TextBox ID="TextBox1" runat="server" TextMode="Time"></asp:TextBox>

TextModeNot CompatibleCompatible
TimeIE(6,7,8,9,10), FirefoxChrome, Safari, Opera

 TextMode = "Url" 

<asp:TextBox ID="TextBox1" runat="server" TextMode="Url"></asp:TextBox>


TextModeNot CompatibleCompatible
UrlIE(6,7,8,9), FirefoxIE 10,11, Chrome, Firefox 29, Opera