Friday 27 January 2012

How to Use Virtual Function in C++

     #include<iostream.h>
      class Window // Base class for C++ virtual function example
      {
         public:
      virtual     void Create(int a) // virtual function for C++ virtual function example
             {
                    cout <<"Base class Window"<<a;
             }
      };

      class CommandButton : public Window
      {
         public:
             void Create()
             {
                  cout<<"Derived class Command Button - Overridden C++ virtual function";
             }

             void Create(int a, int b)
             {
                  cout<<"Derived class Command Button - a and b"<<a<<b;
             }

      };

      void main()
      {
            Window  *x, *y;

         // x = new Window();
         // x->Create();


            //y = new CommandButton();
            //y->Create(10);

            CommandButton *cb;
            cb=new CommandButton();
            cb->Create();
            cb->Create(140,2);
            }

Thursday 26 January 2012

Declaring Array in Java Language

class ArrayExample
    {
    public static void main(String abc[])
        {

             //Array Are Objects in Java
                 
            //int []a={2,4,6,8,10,12,14,16,18,20};
                          
                  int[] a=new int[10];
                             
                       for(int i=0; i<=9; i++)
            {
                     a[i]=2+i;


                   
            System.out.println(a[i]);
               
            }//end of the loop


        }//end main function
    }//end class

Reading attributes of Tag

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Location, Location, Location</title>
<script>
function showattribs() {
var e = document.getElementById("t");
var elemList = "";
 for (var element in e) {
 var attrib = e.getAttribute(element);
 elemList = elemList + element + ": " + attrib + "\n";
 }
alert(elemList);
}
</script>
</head>
<body>
<a onclick="return showattribs();" href="tahirkhalid.blogspot.com"
id="t">Tahir Khalid Site</a>
<script type="text/javascript">
</script>
</body>
</html>

Wednesday 25 January 2012

Walking or Reading through the properties of Location Object of Browser

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Location, Location, Location</title>
</head>
<body>
<script type="text/javascript">
var body = document.getElementsByTagName("body")[0];
for (var prop in location) {
var elem = document.createElement("p");
var text = document.createTextNode(prop + ": " + location[prop]);
elem.appendChild(text);
body.appendChild(elem);
}
</script>
</body>
</html>

Monday 23 January 2012

Inheritance Example in C++

#include<iostream.h>
#include<conio.h>

class human{
       public:
              int age;
              char name[10];
       int setage(int a)
       {
           age=a;
       }
       int getage()
       {
           return age;
       }
       };

class student : public human {
       public:
           int education;
         int seteducation(int e)
         {
         education=e;
         return 0;
         }
         int  geteducation()
         {
         return education;
         }
       };

class bit :public student
{
};

int main()
{
    bit s;
    s.setage(23);
    int x=s.getage();
    cout<<"The Value Of Age = "<<x;
    s.seteducation(12);
    int u=s.geteducation();
    cout<<"\nThe Education Becomes = "<<u;
    getch();
 }

CSS For Zabira Records in Table


/* CSS For Zabira  Records */

body {
background-color: #e5e5e5;
font-family: Arial, Helvetica, sans-serif;
}
#listing {
width: 1000px;
margin-top: 10px;
margin-right: auto;
margin-bottom: 50px;
margin-left: auto;
background-color: #FFFFFF;
padding: 20px;
border: 4px solid #999999;
-moz-border-radius: 9px;
}
h1 {
font-size: 20px;
border-bottom-width: 2px;
border-bottom-style: solid;
border-bottom-color: #000033;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 5px;
margin-left: 0px;
padding: 0px 0px 5px 0px;
}


img {
height: 50px;
width: 50px;
border: 1px solid #000033;
}

th {
text-align: left;
font-size: 15px;
}

td {
font-size: 13px;
}

.even {
background-color: #CCCCCC;

}

.button {
padding: 10px; height: 50px;
width: 100%;
color: #FFFFFF;
background-color: #666666;
border: 1px solid #000000;
font-weight: bold;
cursor:pointer;
-moz-border-radius: 5px;
}

Saturday 21 January 2012

inserting records in PHP after Connection

<?php
$username = "root";
$password = "";
$hostname = "localhost";
$studentname=$_GET["stname"];
$studentimage=$_GET["stimage"];
$studentquestion=$_GET["stquestion"];
$studentanswer=$_GET["stanswer"];

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
  or die("Unable to connect to MySQL");
//echo "Connected to MySQL now you can create Table new one  <br>";
//select database
mysql_select_db("student_db",$dbhandle);
//echo "data Base Selected";
//command to be run by the DBMS  Mysql or ACESS
$query = "insert into student(student_name,student_image,student_question,answer_question) values('$studentname','$studentimage','$studentquestion','$studentanswer')  ";
// run the query and store the results in the $result variable.
mysql_query($query,$dbhandle) or die("cannot do the query");
?>

Display records in php after connection

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Delete Multiple Rows using PHP and MySQL</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" />


</head>
<body>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script>
$(document).ready(function() {
$("tr:nth-child(even)").addClass("even");

 });


</script>

<div id="container">
    <div id="listing">
    <center><h1>IT and Computer Science Forum</h1></center>
    <!-- now we need to loop throguh and display our fields -->
    <?php
$username = "root";
$password = "";
$hostname = "localhost";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
  or die("Unable to connect to MySQL");
//echo "Connected to MySQL now you can create Table new one  <br>";
//select database
mysql_select_db("student_db",$dbhandle);
//echo "data Base Selected";

$query = "SELECT * FROM student";


// run the query and store the results in the $result variable.

$result =mysql_query($query,$dbhandle) or die("cannot do the query");


if ($result) {
  // create a new form and then put the results
  // indto a table.
  echo "<form method='post' action='delete.php'>";
  echo "<table cellspacing='0' cellpadding='15'>
         
          <th width='10%'>StudentID</th>
          <th width='10%'>StudentName</th>
        <th width='10%'>StudentImage</th>
        <th width='35%'>StudentQuestion</th>
        <th width='35%'>AnswerQuestion</th>
        ";
   
   
  while ($row = mysql_fetch_array($result)) {
        $student_id = $row['student_id'];
        $student_name = $row['student_name'];
        $student_image = $row['student_image'];
        $student_question = $row['student_question'];
        $answer_question = $row['answer_question'];
       
               
        //put each record into a new table row with a checkbox
    echo "<tr>
            <td>$student_id</td>
            <td>$student_name</td>
            <td><img src='$student_image' /></td>
            <td>$student_question</td>
            <td>$answer_question</td>
            <td><input type='checkbox' name='checkbox[]' id='checkbox[]'  value=$student_id />
                         </tr>";
   
    }
   
    // when the loop is complete, close off the list.
    echo "</table><p><input id='reply' type='submit' class='button' name='reply' value='Reply To Question'/></p></form>";
}


?>
    </div>
</div><!-- end container -->

</body>
</html>

Inserting dynamically any tag at any position in the HTML using JS and DOM

<
<
html xmlns="http://www.w3.org/1999/xhtml" >head><title>Untitled Page</title>



<script> function go() { var childNodes = document.body.childNodes // containing a array of Tags of body having DIV Tag at// childNodes[0]=Div Tag// childNodes[1]=UL Tag// childNodes[2]=Button Tag
var x=childNodes.item(1) //accessing the UL tag which has a index no 1 in childNodes array

ndiv.style.width=
ndiv.style.height=
ndiv.innerHTML=
ndiv.style.backgroundColor=
var ndiv=document.createElement("DIV");"200px";"100px";"I am New DIV created in JS function ";"skyblue"x.appendChild(ndiv);

}

</script> </
<
head>body>




<div id="d1">First Div defined in HTML Body has id no. d1 </div> <ul> <li>Bob</li> <li>Alice</li> </ul> <button onclick="go()" style="width:100px">Go!</button> </
</
body>html>

Friday 20 January 2012

Student Class in C++ OOPs Example

#include<iostream>
#include<conio.h>
using namespace std;
class Student{
      private:
              int marks;
      public:
             void setMarks(int a){
                  marks=a;
                  }
             void getMarks(){
                  cout<<"marks of student is "<<marks<<endl;
                  }
      };
      int main(){
          Student s1;
          s1.setMarks(84);
          s1.getMarks();
          s1.setMarks(90);
          s1.getMarks();
          getch();
          return 0;
          }
         

Simple object creation example of C++ Language

#include<iostream>
#include<conio.h>
using namespace std;
class cons{
      private:
              int a,b;
      public:
            cons(){
             cout<<"This is constructor which is automtically called\n";
             a=b=50;
             }
             cons(int x, int y){
             cout<<"Value of X is"<<x<<endl;        
             cout<<"Value of Y is "<<y<<endl;        
             }
             void get(){
             cout<<"Value of A is "<<a<<endl;
             cout<<"Value of B is "<<b;    
             }
                    };
int main(){
    cons c(10,20),d;
    d.get();
    getch();
    return 0;
    }

Tuesday 17 January 2012

Add Edit Delete Search Clear Button C sharpe coding

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;


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

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection scon = new SqlConnection("Data Source=Tahir-PC;Initial Catalog=Shipping;Integrated Security=True");
        SqlCommand scmd = new SqlCommand("select PO from PO_Table" , scon);
        SqlDataAdapter sda = new SqlDataAdapter(scmd);
        DataSet ds = new DataSet();
        //DataTable dt = new DataTable();      
        sda.Fill(ds);
              
        if (TextBox1.Text == ds.Tables[0].Rows[0][0].ToString())
        {
            Response.Write("PO already Enter");
        }   
        else
        {

            SqlConnection use = new SqlConnection(" Data Source=Tahir-PC;Initial Catalog=Shipping;Integrated Security=True ");
            SqlDataAdapter da = new SqlDataAdapter();
            da.InsertCommand = new SqlCommand("insert into PO_Table values (@PO, @Style_Ref, @Price, @Season, @Order_Qty, @PO_Ship_Date, @PO_Shipping_Month, @PO_Shipping_Mode, @PO_Value, @PO_Destination)", use);
            da.InsertCommand.Parameters.Add("@PO", SqlDbType.Int).Value = TextBox1.Text;
            da.InsertCommand.Parameters.Add("@Style_Ref", SqlDbType.NVarChar).Value = TextBox2.Text;
            da.InsertCommand.Parameters.Add("@PO_Destination", SqlDbType.NVarChar).Value = DropDownList3.Text;
            da.InsertCommand.Parameters.Add("@Price", SqlDbType.Money).Value = TextBox3.Text;
            da.InsertCommand.Parameters.Add("@Season", SqlDbType.NVarChar).Value = DropDownList2.Text;
            da.InsertCommand.Parameters.Add("@Order_Qty", SqlDbType.Int).Value = TextBox4.Text;
            da.InsertCommand.Parameters.Add("@PO_Ship_Date", SqlDbType.DateTime).Value = TextBox5.Text;
            da.InsertCommand.Parameters.Add("@PO_Shipping_Month", SqlDbType.Char).Value = TextBox6.Text;
            da.InsertCommand.Parameters.Add("@PO_Shipping_Mode", SqlDbType.Char).Value = TextBox7.Text;
            da.InsertCommand.Parameters.Add("@PO_Value", SqlDbType.Int).Value = TextBox8.Text;
            use.Open();
            da.InsertCommand.ExecuteNonQuery();
            use.Close();
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            TextBox5.Text = "";
            TextBox6.Text = "";
            TextBox7.Text = "";
            TextBox8.Text = "";
       
           
                  
           
            }
       

       
         scon.Close();


      
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox5.Text = "";
        TextBox6.Text = "";
        TextBox7.Text = "";
        TextBox8.Text = "";
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        SqlConnection scon = new SqlConnection("Data Source=Tahir-PC;Initial Catalog=Shipping;Integrated Security=True");
        SqlCommand scmd = new SqlCommand("select * from PO_Table", scon);
        SqlDataAdapter sda = new SqlDataAdapter(scmd);
        DataTable dt = new DataTable();
        sda.Fill(dt);

        if (TextBox1.Text == dt.Rows[0][0].ToString())
        {
            TextBox1.Text = dt.Rows[0][0].ToString();
            TextBox2.Text = dt.Rows[0][1].ToString();
            TextBox3.Text = dt.Rows[0][2].ToString();
            TextBox4.Text = dt.Rows[0][4].ToString();
            TextBox5.Text = dt.Rows[0][5].ToString();
            TextBox6.Text = dt.Rows[0][6].ToString();
            TextBox7.Text = dt.Rows[0][7].ToString();
            TextBox8.Text = dt.Rows[0][8].ToString();
            DropDownList2.Text = dt.Rows[0][3].ToString();
            DropDownList3.Text = dt.Rows[0][9].ToString();

        }
        else
        {
            Response.Write("PO Not Found");

        }
        scon.Close();


    }

    protected void Button4_Click(object sender, EventArgs e)
    {
        SqlConnection use = new SqlConnection(" Data Source=Tahir-PC;Initial Catalog=Shipping;Integrated Security=True ");
        SqlDataAdapter da = new SqlDataAdapter();
        da.UpdateCommand = new SqlCommand("update PO_Table set PO=@PO, Style_Ref=@Style_Ref, Price=@Price, Season=@Season, Order_Qty=@Order_Qty, PO_Ship_Date=@PO_Ship_Date, PO_Shipping_Month=@PO_Shipping_Month, PO_Shipping_Mode=@PO_Shipping_Mode, PO_Value=@PO_Value, PO_Destination=@PO_Destination where PO=@PO", use);
        da.UpdateCommand.Parameters.Add("@PO", SqlDbType.Int).Value = TextBox1.Text;
        da.UpdateCommand.Parameters.Add("@Style_Ref", SqlDbType.NVarChar).Value = TextBox2.Text;
        da.UpdateCommand.Parameters.Add("@PO_Destination", SqlDbType.NVarChar).Value = DropDownList3.Text;
        da.UpdateCommand.Parameters.Add("@Price", SqlDbType.Money).Value = TextBox3.Text;
        da.UpdateCommand.Parameters.Add("@Season", SqlDbType.NVarChar).Value = DropDownList2.Text;
        da.UpdateCommand.Parameters.Add("@Order_Qty", SqlDbType.Int).Value = TextBox4.Text;
        da.UpdateCommand.Parameters.Add("@PO_Ship_Date", SqlDbType.DateTime).Value = TextBox5.Text;
        da.UpdateCommand.Parameters.Add("@PO_Shipping_Month", SqlDbType.Char).Value = TextBox6.Text;
        da.UpdateCommand.Parameters.Add("@PO_Shipping_Mode", SqlDbType.Char).Value = TextBox7.Text;
        da.UpdateCommand.Parameters.Add("@PO_Value", SqlDbType.Int).Value = TextBox8.Text;
       
        use.Open();
        da.UpdateCommand.ExecuteNonQuery();
        use.Close();
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox5.Text = "";
        TextBox6.Text = "";
        TextBox7.Text = "";
        TextBox8.Text = "";
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        SqlConnection use = new SqlConnection(" Data Source=Tahir-PC;Initial Catalog=Shipping;Integrated Security=True ");
        SqlDataAdapter da = new SqlDataAdapter();
        da.DeleteCommand = new SqlCommand("delete from PO_Table where PO=@PO", use);
        da.DeleteCommand.Parameters.Add("@PO", SqlDbType.Int).Value = TextBox1.Text;
        da.DeleteCommand.Parameters.Add("@Style_Ref", SqlDbType.NVarChar).Value = TextBox2.Text;
        da.DeleteCommand.Parameters.Add("@PO_Destination", SqlDbType.NVarChar).Value = DropDownList3.Text;
        da.DeleteCommand.Parameters.Add("@Price", SqlDbType.Money).Value = TextBox3.Text;
        da.DeleteCommand.Parameters.Add("@Season", SqlDbType.NVarChar).Value = DropDownList2.Text;
        da.DeleteCommand.Parameters.Add("@Order_Qty", SqlDbType.Int).Value = TextBox4.Text;
        da.DeleteCommand.Parameters.Add("@PO_Ship_Date", SqlDbType.DateTime).Value = TextBox5.Text;
        da.DeleteCommand.Parameters.Add("@PO_Shipping_Month", SqlDbType.Char).Value = TextBox6.Text;
        da.DeleteCommand.Parameters.Add("@PO_Shipping_Mode", SqlDbType.Char).Value = TextBox7.Text;
        da.DeleteCommand.Parameters.Add("@PO_Value", SqlDbType.Int).Value = TextBox8.Text;

        use.Open();
        da.DeleteCommand.ExecuteNonQuery();
        use.Close();
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox5.Text = "";
        TextBox6.Text = "";
        TextBox7.Text = "";
        TextBox8.Text = "";
    }
}



add,edit,delete,search,data clear form in C# with Database

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Add New PO</title>
    <style type="text/css">
        .style1
        {
            font-family: Garamond;
            font-size: xx-large;
        }
        .style2
        {
            text-align: center;
        }
        </style>
</head>
<body>
    <p class="style2">
        <span class="style1" lang="en-us">&nbsp;Add, View, Edit P.O </span></p>
    <form id="form1" runat="server">
    <div class="style2">
   
        <div class="style2">
   
        <br />
        <asp:Label ID="Label1" runat="server" Text="P.O No"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
        <asp:Label ID="Label2" runat="server" Text="Style Ref No"></asp:Label>
        <asp:TextBox ID="TextBox2" runat="server" Width="425px"></asp:TextBox>
        <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
        <asp:Label ID="Label3" runat="server" Text="Destination"></asp:Label>
            <asp:DropDownList ID="DropDownList3" runat="server"
                DataSourceID="SqlDataSource1" DataTextField="Destination"
                DataValueField="Destination" Height="16px" Width="130px">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                ConnectionString="<%$ ConnectionStrings:ShippingConnectionString %>"
                SelectCommand="SELECT * FROM [Destination_Table]"></asp:SqlDataSource>
        </div>
        <br />
        <br />
        <asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
        <br />
        <br />
        <span lang="en-us">&nbsp;&nbsp; </span>
        <asp:Label ID="Label4" runat="server" Text="Price"></asp:Label>
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span>
        <asp:Label ID="Label5" runat="server" Text="Season"></asp:Label>
        <asp:DropDownList ID="DropDownList2" runat="server"
            DataSourceID="SqlDataSource2" DataTextField="Season" DataValueField="Season"
            Height="19px" Width="130px">
        </asp:DropDownList>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"
            ConnectionString="<%$ ConnectionStrings:ShippingConnectionString %>"
            SelectCommand="SELECT [Season] FROM [Season_Table]"></asp:SqlDataSource>
        <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span>
        <asp:Label ID="Label6" runat="server" Text="Order QTY"></asp:Label>
        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
        <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
        <asp:Label ID="Label7" runat="server" Text="Ship Date"></asp:Label>
        <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
        <br />
        <br />
        <br />
        <br />
        <br />
        <asp:Label ID="Label8" runat="server" Text="P.O Month"></asp:Label>
        <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
        <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
        <asp:Label ID="Label9" runat="server" Text="Ship Mode"></asp:Label>
        <asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
        <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span>
        <asp:Label ID="Label10" runat="server" Text="P.O Value"></asp:Label>
        <asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button
            ID="Button3" runat="server" onclick="Button3_Click" Text="Search"
            Width="100px" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button
            ID="Button4" runat="server" onclick="Button4_Click" Text="Edit" Width="100px" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span>
        <asp:Button ID="Button2" runat="server" Height="26px" onclick="Button2_Click"
            Text="Clear" Width="100px" />
        <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="Button5"
            runat="server" Text="Delete" Width="100px" onclick="Button5_Click" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span>
        <asp:Button ID="Button1" runat="server" Height="26px" onclick="Button1_Click"
            Text="Submit" Width="101px" />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
   
    </div>
 
    </form>
</body>
</html>

Monday 16 January 2012

selecting Data from database for checking of duplication and then inserting into table in C#

SqlConnection scon = new SqlConnection("Data Source=FAISALN;Initial Catalog=Shipping;Integrated Security=True");
        SqlCommand scmd = new SqlCommand("select PO from PO_Table Where PO=@PO", scon);
        scmd.Parameters.Add("PO", SqlDbType.Int).Value=TextBox1.Text;
        SqlDataAdapter sda = new SqlDataAdapter(scmd);
        DataSet ds = new DataSet();
        sda.Fill(ds);

       
        if (TextBox1.Text == ds.Tables[0].Rows[0][0].ToString())
        {


            Response.Write("PO Already Exists");

        }

        else
        {
            SqlConnection use = new SqlConnection(" Data Source=FAISALN;Initial Catalog=Shipping;Integrated Security=True ");
            SqlDataAdapter da = new SqlDataAdapter();
            da.InsertCommand = new SqlCommand("insert into PO_Table values (@PO, @Style_Ref, @Price, @Season, @Order_Qty, @PO_Ship_Date, @PO_Shipping_Month, @PO_Shipping_Mode, @PO_Value, @PO_Destination)", use);
            da.InsertCommand.Parameters.Add("@PO", SqlDbType.Int).Value = TextBox1.Text;
            da.InsertCommand.Parameters.Add("@Style_Ref", SqlDbType.NVarChar).Value = TextBox2.Text;
            da.InsertCommand.Parameters.Add("@PO_Destination", SqlDbType.NVarChar).Value = DropDownList3.Text;
            da.InsertCommand.Parameters.Add("@Price", SqlDbType.Money).Value = TextBox3.Text;
            da.InsertCommand.Parameters.Add("@Season", SqlDbType.NVarChar).Value = DropDownList2.Text;
            da.InsertCommand.Parameters.Add("@Order_Qty", SqlDbType.Int).Value = TextBox4.Text;
            da.InsertCommand.Parameters.Add("@PO_Ship_Date", SqlDbType.DateTime).Value = TextBox5.Text;
            da.InsertCommand.Parameters.Add("@PO_Shipping_Month", SqlDbType.Char).Value = TextBox6.Text;
            da.InsertCommand.Parameters.Add("@PO_Shipping_Mode", SqlDbType.Char).Value = TextBox7.Text;
            da.InsertCommand.Parameters.Add("@PO_Value", SqlDbType.Int).Value = TextBox8.Text;
            use.Open();
            da.InsertCommand.ExecuteNonQuery();
            use.Close();
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            TextBox5.Text = "";
            TextBox6.Text = "";
            TextBox7.Text = "";
            TextBox8.Text = "";

        }

        scon.Close();

Friday 13 January 2012

CSS Cascading Style Sheet for your HTML Page or Master Page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>master page</title>
<style type="text/css">
#container{
 width:1000px;
 height:auto;
 margin:auto;
}
#header
{
 height:150px;
 width:auto;
 background-color:#33CCCC;
}
#logo
{
 width:150px;
 float:left;
 margin:5px;
 background-color:#006699;
 height:140px;
}
#slogan
{
 width:200px;
 height:140px;
 margin:5px;
 float:right;
 background-color:#33CC33;
}
#leftsidebar
{
 width:200px;
 height:600px;
 background-color:#3366CC;
 float:left;
}
#main
{
width:800px;
float:left;
 height:600px;
 background-color:#003399;
}
#footer
{
clear:both;
 height:50px;
 background-color:#6600CC;
 width:1000px;
}
</style>
</head>
<body>
<div id="container">
<div id="header">
<div id="logo"></div>
<div id="slogan"></div>
</div>
<div id="leftsidebar"></div>
<div id="main"></div>
<div id="footer"></div>
</div>
</body>
</html>

How to Extract the Data from DataSet Object In C# Lanaguage

 SqlConnection scon = new SqlConnection("database=StudentDB;trusted_connection=yes");
        SqlCommand scmd = new SqlCommand("select* from StudentInfoTable", scon);
        SqlDataAdapter sda = new SqlDataAdapter(scmd);
        DataSet ds = new DataSet();
        sda.Fill(ds);
        TextBox1.Text = ds.Tables[0].Rows[0][0].ToString(); //The Main Line to understand        scon.Close();

Tuesday 10 January 2012

Most Common Interrupts of Assembly Language

INT 10H   : Related to Video Services

INT 16H   : Related to Keyboard Services
INT 17H   : Related to Printer Services

INT IAH   : Related to Time of the Day

INT 1CH   : Related  User Timer Interrupt
INT 21H   : Dos Services; for example I/O , file handling , memory Management

Assembly Languag Programming of Intel Processor 8086

Transforming the Computer form text Mode to Graphics.
Mov ah,0; //set Video Mode
Move al,6;  //640X200 color graphics Mode
int 10H;   // Call Interrupt 10H in Rom
Mov ah,1;// get a key Stoke
int 21H
Mov ah,0 ; again set vidio mode
Mov al,3; set to Color Text Mode
int 10H;



Tuesday 3 January 2012

Front End for taking input from textbox and button to press


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Height="26px" onclick="Button1_Click"
            Text="Button" />
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
   
    </div>
    </form>
</body>
</html>


//Back End in Button Click Event

protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection scon = new SqlConnection("database=Tahir_Khalid;trusted_connection=yes");
        SqlCommand scmd = new SqlCommand("select * from Tahir where RollNo=@rollno", scon);
        scmd.Parameters.Add("rollno", SqlDbType.Int).Value = TextBox1.Text;
        SqlDataAdapter sda = new SqlDataAdapter(scmd);
        DataSet ds = new DataSet();
        sda.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }