Wednesday, October 09, 2013

Database Intro

Software is a set of instruction to perform a particular task

Database is collection of tables.

Table is a collection of columns which stores information in the form of rows. which refers to a records.


RDBMS or DBMS (Relational Database Management System or Database Management System)
Is a software which is use to manage data.
Operations like Adding new records and modifying old records and delete the old records are performed in Database

Various Databases are like Oracle, Microsoft, MySql.


Microsoft Access is a graphical tool to create database and manage tables in a database.

Simplest Example of a Database operations is a mobile phone Contacts

Mobile-> Database

Contacts-> table

Records  of our friends
firstname
lastname
middlename
mobileno
homeno
email
dob
address
 all the above  are the columns of a contact table

task on the table

new
modify
delete





How to open MS Access.

Start -> All Programs ->  Microsoft  Office ->  Access

Case Study:
I want to store information about the details of a school.

Information we need to store in a school database.
1. Students
2.Staff
3.Class
4.Exam
5.Subject

Database Name : SchoolDB
Tables in a SchoolDB Database
1. Table Name: Students
2. Table Name: Staff
3. Table Name: Class
4. Table Name: Exam
5. Table Name: Subject


Columns in Students Table:

RollNo.
FirstName
LastName
MiddleName
MobileNo.
HomeNo
FatherName
Mothers Name
Email
DOB
Age
Address
ClassName
LastClassScore
LastSchoolName
FeePaid
Section

   Columns in Staff Table:
       
         FirstName
LastName
MiddleName
MobileNo.
HomeNo
Email
Address
Qualification
Post
Exp
Salary
LastSchoolName


Columns in Class Table:

ClassID
Classname
fee


Columns for Exam Table

ClassID
SubjectID
Rollno
Marks

Columns for Subject Table

SubjectID
SubjectName
ClassID







Wednesday, September 25, 2013

How to create a Blog

1. Create a Email Id
2. Register in www.blogger.com
3. Follow the steps and create the blog.
4. Create new post on your blog.
5. Publish your Blog.
6. View your blog.

Saturday, September 21, 2013

AD Rotator with timer

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

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<asp:Timer ID="Timer2" runat="server" Interval="1000">
</asp:Timer>

<asp:UpdatePanel ID="UpdatePanel2" runat="server">

<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer2" EventName="Tick" />
</Triggers>

<ContentTemplate>

<asp:AdRotator ID="AdRotator2" runat="server" DataSourceID="XmlDataSource2" />
<asp:XmlDataSource ID="XmlDataSource2" runat="server" DataFile="~/XMLFile2.xml">
</asp:XmlDataSource>

</ContentTemplate>

</asp:UpdatePanel>

</form>

Tuesday, September 03, 2013

Lesson 2 in ASP.NET (using HTML)



To Create the following layout write the code below

<!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>
    <title>Online Exam System Help</title>
    <style type="text/css">
    h1{color:Orange;
       }
     
        .style1
        {
            font-size: xx-large;
            font-weight: bold;
        }
     
       </style>
</head>
<body>
<div class="header"><img src="images/ID.jpg" atr="Online System"
        style="height: 217px; width: 700px" /><br /><font face="Courier New" color="#0066ff" size="100pt">Testing System</font></div>
<div class="sidebar">
<h1>Exams</h1>
    <ol>
    <li>C++</li>
    <li>Java</li>
    <li>PHP</li>
    <li>MySQL</li>
    <li>Oracle</li>
    <li>ASP.NET</li>  
    </ol>
</div>
<div class="content">
<h1>Exam Details</h1>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td valign=top>C++</td>
<td>Details of the Programming with C++ Test are as follows. Principles of Object-Oriented Programming:
Tokens. Expressions and sequences. Functions with C++. Classes and objects, Constructors and destructors, Operator overloading and type conversions.


Inheritance:
Extending classes, Pointers, Virtual functions and polymorphism, Managing console I/O operations, Working with files.


C++ I/O Systems:
C++ I/O basics, Formatted I/O, Manipulators, User defined inserters, Extractors and Manipulators.

</td>

</tr>
<tr>
<td valign=top>Java</td>
<td>Java Exam Details are as follows.  Introduction to OOPs AND JAVA, Understanding the Fundamentals, Working with Access Specifiers and Functions, Constructors, Destructors and Inheritance,
Exception Handling, Graphical User Interface Programming (GUI), Event Handling, Working with Threads, File Handling, Collections, Generics and Annotations, Networking with Java, Remote Method Invocation (RMI), Java Database Connectivity (JDBC) and JavaBeans
</td>

</tr>
<tr>
<td valign=top>PHP</td>
<td>PHP Exam Details</td>

</tr>
<tr>
<td valign=top>MySQL</td>
<td>MySQL Exam Details</td>

</tr>
<tr>
<td valign=top>Oracle</td>
<td>Oracle Exam Details</td>

</tr>
<tr>
<td valign=top>ASP.NET</td>
<td>ASP.NET Exam Details</td>

</tr>

</table>

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

Lesson 1 ASP.NET (Use Of HTML)


To Create this output write the following code in notepad and run it in Internet Broswer.

<!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>
    <title>Online Testing Website</title>
    <style type="text/css">
    h1{color:Orange;}
H2{COLOR:RED;}
    </style>
    <script type="text/javascript">
        function selectexam() {

            alert('You have select ' + selectExam.value);
            mainframe.document.body.innerHTML = "";

            if (selectExam.value == "C++") {
                mainframe.document.write("You Have Selected C++ Exam");
                mainframe.document.body.style.background = "ff3333";

            }
            if (selectExam.value == "Java"){
                mainframe.document.write("You Have Selected Java Exam");
                 mainframe.document.body.style.background = "66cc33";

            }
            if (selectExam.value == "PHP"){
                mainframe.document.write("You Have Selected PHP Exam");
                 mainframe.document.body.style.background = "00ff99";

            }
            if (selectExam.value == "MySQL"){
                mainframe.document.write("You Have Selected MySQL Exam");
                 mainframe.document.body.style.background = "66ccff";

            }
            if (selectExam.value == "Oracle"){
                mainframe.document.write("You Have Selected Oracle Exam");
                 mainframe.document.body.style.background = "ff00ff";

            }
            if (selectExam.value == "ASP.NET"){

                mainframe.document.write("You Have Selected ASP.NET Exam");
            mainframe.document.body.style.background = "ccff33";

            }
            if (selectExam.value == "C#.NET"){

                mainframe.document.write("You Have Selected C#.NET Exam");
            mainframe.document.body.style.background = "RED";

            }

        }
   
    </script>
</head>
<body>
<div id="BodyContent">
<h1>Online Testing System</h1>
<h2>Welcome Students</h2>
<hr />
Please Select The Exam:
<select id="selectExam">
<option value="C++">C++</option>
<option value="Java">Java</option>
<option value="PHP">PHP</option>
<option value="MySQL">MySQL</option>
<option value="Oracle">Oracle</option>
<option value="ASP.NET">ASP.NET</option>
<option value="C#.NET">C#.NET</option>

</select>
<input id="buttonselect" type="button" value="Select" onclick="selectexam()" />
</div>
<div id="Frameid"><iframe id="mainframe" name="mainframe" frameborder=1 width=1300 height=500></iframe></div>
</body>
</html>

Friday, August 02, 2013

Save Button Code in ASP.Net

First Insert these lines at the top of code bind file

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


Second step is to write this line inside your class

string _connStr = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;


Third step is to write this code in save button event


protected void btnsubmit_Click(object sender, EventArgs e)
    {
        try
        {
            String struserid, strpassword, strfirstname, strmiddlename, strlastname;
            String stremailid, strmobilenumber, strcollegename;
            struserid = txtuserid.Text;
            strpassword = txtpassword.Text;
            strfirstname = txtfirstname.Text;
            strmiddlename = txtmiddlename.Text;
            strlastname = txtlastname.Text;
            stremailid = txtemailid.Text;
            strmobilenumber = txtmobile.Text;
            strcollegename = txtcollegename.Text;
            SqlConnection con = new SqlConnection();
            con.ConnectionString = _connStr;
            String strinsert = "insert into profiledata(userid,firstname,middlename,lastname,emailid,mobile,collegename,password) values('" + struserid + "','" + strfirstname + "','" + strmiddlename + "','" + strlastname + "','" + stremailid + "','" + strmobilenumber + "','" + strcollegename + "','" + fileName + "','" + imageBytes + "','" + strpassword + "')";
            con.Open();

            SqlCommand cmd = new SqlCommand(strinsert, con);
            cmd.ExecuteNonQuery();
            con.Close();
        }
        catch (Exception exp)
        {
            Label1.Text = "Error in inserting Data";
        }



    }

Sign In Code in ASP.Net

First Insert these lines at the top of your code bind file.

using System.Data;
using System.Configuration;
using System.Data.SqlClient;

Second step is to write this code in signin button event

protected void btnSignIn_Click(object sender, EventArgs e)
    {
        String struserid = txtuserid.Text;
        String strpassword = txtpassword.Text;
        if (struserid == "" && strpassword == "")
        {
            Label1.Text = "Please Valid User ID";
            Label2.Text = "Please Fill Valid Password";
        }
        else
        {
            SqlConnection con = new SqlConnection();
            con.ConnectionString = _connStr;
            String strselect = "select userid,password from profiledata where userid='" + struserid + "' and password='" + strpassword + "'";
            con.Open();
            SqlCommand cmd = new SqlCommand(strselect,con);
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read())
            {
                Session["sessionuserId"] = struserid;
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('mygallary.aspx','frame1');", true);
             
            }
            else
            {
                Label1.Text = "Please Valid User ID";
                Label2.Text = "Please Fill Valid Password";
         
            }

        }
    }

Tuesday, July 30, 2013

Database Commands

Student
   
    regno
    name
    emailid
    mobile

insert into student (regno,name,emailid,mobile)values('1001','jatinder','jatinder@yahoo.com','98989898')

delete a data from a table
string selectstr="

select * from tablename where

columnname='"+variablename+"'"

delete student
string delstr="delete student where regno='"+variablename+"'";


update data into the table

string selectstr="select * from tablename where columnname='"+variablename+"'"

string strregno=regno(columns from database)
string strname=name(columns from database)
string stremailid=emailid(columns from database)
string strmobile=mobile(columns from database)

txtregno.Text= strregno;
txtname.Text= strname;
txtemailid.Text= stremailid;
txtmobile.Text= strmobile;

Update

string updatestr="update student set name='"+variablename+"',emailid='"+variablename+"',mobile='"+variablename+"'
where regno='"+variablename+"'"




displaying data in a form
   
    all records
        Reports

    specific records
   
        command

    one record
        command

string selectstr="select * from tablename"

string selectstr="select * from tablename where columnname='"+variablename+"'"

string selectstr="select * from tablename where columnname='"+variablename+"' and columnname='"+variablename+"'"

insert into student(regno,name,emailid,mobile)values('1006','jatin','jatin@yahoo.com','981409999')
insert into student(regno,name,emailid,mobile)values('1002','inder','inder@yahoo.com','981409999')
insert into student(regno,name,emailid,mobile)values('1003','tinder','tinder@yahoo.com','981409999')
insert into student(regno,name,emailid,mobile)values('1004','jati','jati@yahoo.com','981409999')
insert into student(regno,name,emailid,mobile)values('1005','der','der@yahoo.com','981409999')

update student
set mobile='9814902980',name='satinder'
where regno='1002'


select * from student

select * from student where name='jatinder' and mobile='9814902957'

delete student where name='jatinder'

Saturday, July 27, 2013

First HTML Page

<html>
 <head>
 <title>
  My First Page
 </title>
 </head>

<body bgcolor=ff6666>
<h2>About Me</h2>
<table border =1>
<tr><td><b>Name:</b></td><td> <i>Jatinder &nbsp;&nbsp;&nbsp;&nbsp;        Singh
Randhawa</i><br></td></tr>
<tr><td><b>Office Address:</b></td><td> NIIT Mall road<br></td></tr>
<tr><td><b>Phone:</b></td><td> 01832562301<br></td></tr>
<tr><td></td><td><img src="pic1.jpg" height=100 width=100/></td></tr>
</table>
<font face="Monotype Corsiva" size=10 color=red>Jatinder Randhawa</font>
<marquee behavior="alternate"><font face="Monotype Corsiva" size=10 color=red>Jatinder
Randhawa</font></marquee>

<marquee  behavior="scroll" scrollamount="1" direction="up">Your upward scrolling text goes
here</marquee>



<marquee behavior="scroll" direction="left" onmouseover="this.stop();"
onmouseout="this.start();">Go on... hover over me!</marquee>

http://www.tutorialehtml.com/en/extras/marquee.php


 </body>
</html>