Wednesday, October 29, 2008

10 DATABASE MANAGEMENT SYSTEM AN GRAPHICAL USER INTERFACE USING VISUAL BASIC 6.0






'DATABASE MANAGEMENT SYSTEM AN GRAPHICAL USER INTERFACE USING VISUAL BASIC 6.0
'EXP NO 10 ACTIVE X PROGRAMMING
'**************CODE FOR FORM1*********************

Private Sub Command1_Click()
Print AddressCtl1.AddressText
End Sub

'*********CODE FOR ADDRESS CONTROL*******
Private Sub UserControl_Resize()
With UserControl
'Enforce minimum dimensions
If .Height < 3615 Then .Height = 3615
If .Width < 2175 Then .Width = 2175
'Resize objects on the control
txtName.Width = .ScaleWidth - 500
txtStreet.Width = .ScaleWidth - 500
txtCity.Width = .ScaleWidth - 500
txtZip.Width = .ScaleWidth / 2 - 500
txtState.Width = .ScaleWidth / 2 - 500
'Move the Zipcode text box
txtZip.Left = .ScaleWidth / 2 + 160
lblZip.Left = .ScaleWidth / 2 + 160
End With
End Sub

Public Property Get AddressText() As String
Dim s As String
s = txtName & vbCrLf
s = s & txtStreet & vbCrLf
s = s & txtCity & vbCrLf
s = s & txtState & vbCrLf
s = s & txtZip
AddressText = s
End Property

Sunday, October 26, 2008

SARDAR OF THE DAY

Bomb and Sardar


2 sardaron ko 2 bomb mile,


1st Sardar: chal police ko de k aate hain.


2 sardar: agar koi bomb raaste me phat gaya to?


1st sardar: jhoot bol denge ki 1 hi mila tha

Student Vs Professor

After having failed his exam in "Logistics and Organization" , a student goes and confronts his lecturer about it.

Student: "Sir, do you really understand anything about the subject?"

Professor: "Surely I must. Otherwise I would not be a professor!"

Student: "Great, well then I would like to ask you a question.

If you can give me the correct answer, I will accept my mark as is and go. If you however do not know the answer, I want you give me an "A" for the exam. "

Professor: "Okay, it's a deal. So what is the question?"

Student: "What is legal, but not logical, logical, but not legal, and neither logical, nor legal?"

Even after some long and hard consideration, the professor cannot give the student an answer, and therefore changes his exam mark into an "A", as agreed.

Afterwards, the professor calls on his best student and asks him the same question.

He immediately answers: "Sir, you are 63 years old and married to a 35 year old woman, which is legal, but not logical. Your wife has a 25 year old lover, which is logical, but not legal. The fact that you have given your wife's lover an "A", although he really should have failed, is neither legal, nor logical."

Solid Interview !!----Toooo Funny :-))

Interviewer:Tell me about yourself.

Candidate:I am Rameshwar Kulkarni. I did my Tele Communication engineering from BabanRao Dhole-Patil Institute of Technology.

Interviewer:BabanRao Dhole-Patil Institute of Technology? I had never heard of this college before!

Candidate:Great! Even I had not heard of it before getting an admission into it .. What happened is - due to cricket world cup I scored badly! In 12th.I was getting a aid seat in a good college. But my father said (I prefer to call him 'baap') - "I can not invest so much of money".(The baap actually said - "I will never waste so much of money on you"). So I had to join this college. Frankly speaking this name - babanRao Dhole-Patil, can at the most be related to a Shetakari Mahavidyalaya.

Interviewer:ok, ok. It seems you have taken 6 years to complete your engineering.

Candidate:Actually I tried my best to finish it in 4 years. But you know, these cricket matches and football world cup, and tennis tournaments. It is difficult to concentrate. So I flunked in 2nd and 3rd year. So in all I took 4 + 2 = 7 years.

Interviewer:But 4+2 is 6.

Candidate:Oh, is it? You know I always had KT in maths. But I will try to keep this in mind. 4+2 is 6, good, thanks. These cricket matches really affect exams a lot. I think they should ban it.

Interviewer: Good to know that you want cricket matches to be banned.

Candidate:No, no... I am talking about Exams!!

Interviewer:Ok, What is your biggest achievement in life?

Candidate:Obviously, completing my Engineering. My mom never thought I would complete it. In fact, when I flunked in 3rd year, she was looking for a job for me in BEST (Bus corporation in Maharashtra) through some relative.

Interviewer:Do you have any plans of higher study?

Candidate:he he he... Are you kidding? Completing 'lower' education itself was so much of pain!!

Interviewer:Let's talk about technical stuff. On which platforms have you worked?

Candidate:Well, I work at SEEPZ, so you can say Andheri is my current platform. Earlier I was at Vashi center. So Vashi was my platform then. As you can see I have experience of different platforms! (Vashi and Andheri are the places in Mumbai)

Interviewer:And which languages have you used?

Candidate:Marathi, Hindi, English. By the way, I can keep quiet in German, French, Russian and many other languages.

Interviewer:Why VC is better than VB?

Candidate:It is a common sense - C comes after B. So VC is a higher version than VB. I heard very soon they are coming up with a new language VD!

Interviewer:Do you know anything about Assembly Language?

Candidate:Well, I have not heard of it. But I guess, this is the language our ministers and MPs use in assembly.

Interviewer:What is your general project experience?

Candidate:My general experience about projects is - most of the times they are in pipeline!

Interviewer:Can you tell me about your current job?

Candidate:Sure, Currently I am working for Bata InfoTech ltd. Since joining BIL, I am on Bench. Before joining BIL, I used to think that Bench was another software like Windows.

Interviewer:Do you have any project management experience?

Candidate:No, but I guess it shouldn't be difficult. I know Word and Excel. I can talk a lot. I know how to dial for International phone call and use speaker facility. And very important - I know few words like-'Showstoppers ' , 'hotfixes', 'SEI-CMM','quality','versioncontrol','deadlines' , 'Customer Satisfaction' etc. Also I can blame others for my mistakes!

Interviewer:What are your expectations from our company?

Candidate:Not much.

1. I should at least get 40,000 in hand..
2. I would like to work on a live EJB project. But it should not have deadlines. I personally feel that pressure affects natural talent.
3. I believe in flexi-timings.
4. Dress code is against basic freedom, so I would like to wear t-shirt and jeans.
5. We must have sat-sun off. I will suggest Wednesday off also, so as to avoid breakdown due to overwork.
6. I would like to go abroad 3 times a year on short term preferably 1-2 months) assignments. Personally I prefer US, Australia and Europe. But considering the fact that there is Olympics coming up in China in the current year, I don't mind going there in that period. As you can see I am modest and don't have many expectations. So can I assume my selection?

Interviewer:he he he ha ha ha. Thanks for your interest in our organization. In fact I was never entertained so much before. Welcome to INFOSYS..

The fellow was appointed in a newly created section 'Stress Management' in the HRD of Infosys.

9 CLASS IN VB

'AIM : PROGRAM TO IMPLEMENT CLASS MODULES IN VISUAL BASIC
'NAME : JEKIN . J . TRIVEDI
'CLASS : SE - IT(B5) ROLL NO : 67

'*************************CODE FOR STUDENT CLASS MODULE ****************

Private m_studentid As String
Private m_firstname As String
Private m_lastname As String
Private m_majorcode As String
Private m_yearlevel As String
Private m_birthdate As Date
Property Get StudentID() As String
StudentID = m_studentid
End Property
Property Let StudentID(ByVal strnewvalue As String)
'Raise an error if an invalid assignment is attempted
If Len(strnewvalue) = 0 Then Err.Raise 5 'Ivalid procedure
'argument else stored in the private member variable
m_studentid = strnewvalue
End Property
Property Get firstname() As String
firstname = m_firstname
End Property
Property Let firstname(ByVal strnewvalue As String)
'raise an error if an inalid assignment is attempted
If Len(strnewvalue) = 0 Then Err.Raise 5 'invalid procedure argument
'else store in the private member variable

m_firstname = strnewvalue
End Property
Property Get lastname() As String
lastname = m_lastname
End Property
Property Let lastname(ByVal strnewvalue As String)
'raise an error if an inalid assignment is attempted
If Len(strnewvalue) = 0 Then Err.Raise 5 'invalid procedure argument
'else store in the private member variabel
m_lastname = strnewvalue
End Property
Property Get Majorcode() As String
Majorcode = m_majorcode
End Property
Property Let Majorcode(ByVal strnewvalue As String)
If Len(strnewvalue) = 0 Or Len(strnewvalue) > 1 Then Err.Raise 5
'End If
m_majorcode = strnewvalue
End Property
Property Get yearlevel() As String
yearlevel = m_yearlevel
End Property
Property Let yearlevel(ByVal strnewvalue As String)
Dim vartemp As Variant
Dim found As Boolean
For Each vartemp In Array("Freshman", "sophomore", "Junior", "Senior")
If InStr(1, strnewvalue, vartemp, vbTextCompare) Then
found = True
Exit For
End If
Next
If Not found Then Err.Raise 5
m_yearlevel = strnewvalue
End Property

Property Get birthdate() As Date
birthdate = m_birthdate
End Property
Property Let birthdate(ByVal datnewvalue As Date)
If datnewvalue >= Now Then Err.Raise 1001, , "Future Date!"
m_birthdate = datnewvalue

End Property


'*************************CODE FOR FORM1 ****************

'Declare object of student class
Dim ostudent As Student

Private Sub Command1_Click()


Set ostudent = New Student
'Use the object student
ostudent.StudentID = "990680"
ostudent.firstname = "Dhiraj"
ostudent.lastname = "Vanmali"
ostudent.Majorcode = "A"
ostudent.yearlevel = "Senior"
ostudent.birthdate = "19-9-2008"

Print "Student ID :" & ostudent.StudentID & vbCrLf
Print "First Name :" & ostudent.firstname & vbCrLf
Print "Last Name :" & ostudent.lastname & vbCrLf
Print "Major Code:" & ostudent.Majorcode & vbCrLf
Print "Year: " & ostudent.yearlevel & vbCrLf
Print "Date of Birth:" & ostudent.birthdate

Set ostudent = Nothing


End Sub

DBMS 6 :FILE MANAGEMENT

'file management

Private Sub Command1_Click()
'create file
Dim filesystemobject, textstream As Object
Set filesystemobject = CreateObject("scripting.filesystemobject")
Set textstream = filesystemobject.createtextfile("c:\raja.txt", True)
textstream.write ("Hi")
End Sub

Private Sub Command2_Click()
'move file
Dim filesystemobject, textstream As Object
Set filesystemobject = CreateObject("scripting.filesystemobject")
filesystemobject.movefile "c:\raja.txt", "c:\vcet\raja.txt"


End Sub

Private Sub Command3_Click()
'copy file
Dim filesystemobject, textstream As Object
Set filesysteamobject = CreateObject("scripting.filesystemobject")
filesysteamobject.copyfile "c:\vcet\raja.txt", "c:\raja.txt"


End Sub

Private Sub Command4_Click()
'delete file
Dim filesysteamobject, fileobject As Object
Set filesysteamobject = CreateObject("scripting.filesystemobject")
filesysteamobject.Deletefile "c:\vcet\raja.txt"

End Sub

Private Sub Command5_Click()
'get file creatad date
Dim filesysteamobject As Object
Set filesysteamobject = CreateObject("scripting.filesystemobject")
Set fileobject = filesysteamobject.getfile("c:\raja.txt")
MsgBox "c:\raja.txt" & vbctrf & "was created" & fileobject.datecreated & vbctrf


End Sub

Private Sub Command6_Click()
'get file last accessed date
Dim filesysteamobject As Object
Set filesysteamobject = CreateObject("scripting.filesystemobject")
Set fileobject = filesysteamobject.getfile("c:\raja.txt")
MsgBox "c:\raja.txt" & vbctrf & "was last accessed" & fileobject.datelastaccessed & vbctrf


End Sub

Private Sub Command7_Click()
'get file last modified date
Dim filesysteamobject As Object
Set filesysteamobject = CreateObject("scripting.filesystemobject")
Set fileobject = filesysteamobject.getfile("c:\raja.txt")
MsgBox "c:\raja.txt" & vbctrf & "was last modified date " & fileobject.datelastmodified & vbctrf


End Sub

Private Sub Command8_Click()
'get file length
Dim filesysteamobject As Object
MsgBox "the c:\raja.txt fle" & Str(FileLen("c:\raja.txt")) & "bytes long"
End Sub

Wednesday, October 8, 2008

DBMS PRACTICAL 4 TRANSACTION


SQL> create table emp57(emp_id int,name varchar(20),dept_id int);
create table emp57(emp_id int,name varchar(20),dept_id int)
*
ERROR at line 1:
ORA-00955: name is already used by an existing object


SQL> create table emp257(emp_id int,name varchar(20),dept_id int);

Table created.

SQL> create table dept257(dept_id int,dept_name varchar(20));

Table created.

SQL> insert into emp257 values(01,'MAYANK SHARMA',101);

1 row created.

SQL> insert into emp257 values(02,'BHUSHAN TALEKAR',102);

1 row created.

SQL> insert into emp257 values(03,'SAURABH SHETTY',103);

1 row created.

SQL> insert into emp257 values(04,'ADITYA LOHIA',104);

1 row created.

SQL>
SQL> insert into emp257 values(05,'SACHIN JOSHI',105);

1 row created.

SQL> insert into dept257 values(101,'INFT');

1 row created.

SQL> insert into dept257 values(102,'EXTC');

1 row created.

SQL> insert into dept257 values(103,'MECH');

1 row created.

SQL> insert into dept257 values(104,'COMP');

1 row created.

SQL> insert into dept257 values(105,'INST');

1 row created.

SQL> select * from emp257;

EMP_ID NAME DEPT_ID
---------- -------------------- ----------
1 MAYANK SHARMA 101
2 BHUSHAN TALEKAR 102
3 SAURABH SHETTY 103
4 ADITYA LOHIA 104
5 SACHIN JOSHI 105

SQL> select * from dept257;

DEPT_ID DEPT_NAME
---------- --------------------
101 INFT
102 EXTC
103 MECH
104 COMP
105 INST

SQL> rollback work;

Rollback complete.

SQL> select * from emp257;

no rows selected

SQL> select * from dept257;

no rows selected

SQL> begin transaction;
2 insert into emp257 values(01,'MAYANK SHARMA',101);
3 insert into dept257 values(101,'INFT');
4 commit work;
4 commit work;
5 /
commit work;
*
ERROR at line 4:
ORA-06550: line 4, column 12:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with

DBMS PRACTICLE 2:- DATA MANIPULATION LANGUAGE

PRACTICLE 2:- DATA MANIPULATION LANGUAGE


SQL> create table practicle265(emp_id int primary key,name varchar(20) not null,address varchar(
salary decimal(10,2));

Table created


SQL> insert into practicle265 values(01,'mayank sharma','bhayandar',100000);

1 row created.

SQL> insert into practicle265 values(02,'bhushan talekar','vasai',100000);

1 row created.

SQL> insert into practicle265 values(03,'saurabh shetty','dahisar',100000);

1 row created.

SQL> insert into practicle265 values(04,'khyati vashi','bhayandar',100000);

1 row created.

SQL> insert into practicle265 values(05,'aditya lohia','vasai',100000);

1 row created.

SQL> select * from practicle265;

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 100000
2 bhushan talekar vasai 100000
3 saurabh shetty dahisar 100000
4 khyati vashi bhayandar 100000
5 aditya lohia vasai 100000

SQL>

SQL>
SQL> select emp_id from practicle265;

EMP_ID
----------
1
2
3
4
5



SQL> select emp_id from practicle265 where emp_id=1;

EMP_ID
----------
1

SQL> select * from practicle265 where name='mayank sharma';

EMP_ID NAME ADDRESS SALARY
---------- ------------------- -------------------- ----------
1 mayank sharma bhayandar 100000

SQL> select * from practicle265 where name<>'mayank sharma';

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
2 bhushan talekar vasai 100000
3 saurabh shetty dahisar 100000
4 khyati vashi bhayandar 100000
5 aditya lohia vasai 100000

SQL> select * from practicle265 where salary>10000;

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 100000
2 bhushan talekar vasai 100000
3 saurabh shetty dahisar 100000
4 khyati vashi bhayandar 100000
5 aditya lohia vasai 100000


SQL> select * from practicle265 where emp_id=2 or name='mayank sharma';

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 100000
2 bhushan talekar vasai 100000

SQL> select * from practicle265 where emp_id=2 and name='mayank sharma';

no rows selected

SQL> insert into practicle265(emp_id,name) values(6,'akshay mahtre');

1 row created.

SQL> select * from practicle265;

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 100000
2 bhushan talekar vasai 100000
3 saurabh shetty dahisar 100000
4 khyati vashi bhayandar 100000
5 aditya lohia vasai 100000
6 akshay mahtre

6 rows selected.

SQL> update practicle265 set address='poisar',salary=10205 where emp_id=6;

1 row updated.

SQL> select * from practicle265;

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 100000
2 bhushan talekar vasai 100000
3 saurabh shetty dahisar 100000
4 khyati vashi bhayandar 100000
5 aditya lohia vasai 100000
6 akshay mahtre poisar 10205

6 rows selected.

SQL> update practicle265 set address='bhayandar' where emp_id=5;

1 row updated.

SQL> select * from practicle265;

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 100000
2 bhushan talekar vasai 100000
3 saurabh shetty dahisar 100000
4 khyati vashi bhayandar 100000
5 aditya lohia bhayandar 100000
6 akshay mahtre poisar 10205

6 rows selected.

SQL> select * from practicle265;

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 10000
2 bhushan talekar vasai 10000
3 saurabh shetty dahisar 10000
4 khyati vashi bhayandar 10000
5 aditya lohia bhayandar 10000
6 akshay mahtr poisar 10000

6 rows selected.

SQL> update practicle265 set salary=15000 where emp_id>4;

2 rows updated.

SQL> select * from practicle265;

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 10000
2 bhushan talekar vasai 10000
3 saurabh shetty dahisar 10000
4 khyati vashi bhayandar 10000
5 aditya lohia bhayandar 15000
6 akshay mahtr poisar 15000



6 rows selected.

SQL> select * from practicle265;

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 10000
2 bhushan talekar vasai 10000
3 saurabh shetty dahisar 10000
4 khyati vashi bhayand 10000


SQL> delete from practicle265 where emp_id>2;

2 rows deleted.

SQL> select * from practicle265;

EMP_ID NAME ADDRESS SALARY
---------- -------------------- -------------------- ----------
1 mayank sharma bhayandar 10000
2 bhushan talekar vasai 10000

SQL> delete from practicle265;

2 rows deleted.

SQL> select * from practicle265;

no rows selected

DBMS PRATICLE 1:- DATA DEFINATION LANGUAGE

PRATICLE 1:- DATA DEFINATION LANGUAGE

SQL> create table practicle257(rollno int primary key,name varchar(30) not null);

Table created.

SQL> insert into practicle257 values(1,'mayank sharma');

1 row created.

SQL> insert into practicle257 values(2,'aditya lohia');

1 row created.

SQL> select * from practicle257;

ROLLNO NAME
------------- ------------------------------
1 mayank sharma
2 aditya lohia

SQL> alter table practicle257 add(address varchar(20));

Table altered.

SQL> select * from practicle257;

ROLLNO NAME ADDRESS
---------- ------------------------------ --------------------
1 mayank sharma
2 aditya lohia

SQL> alter table practicle257 drop column address;

Table altered.

SQL> select * from practicle257;

ROLLNO NAME
------------ ------------------------------
1 mayank sharma
2 aditya lohia

DBMS PRACTICAL 3 VIEW DEFINATION LANGUAGE





PRACTICAL 3:- VIEW DEFINITION LANGUAGE



SQL> create table emp57(emp_id varchar(10) primary key , emp_name varchar(20) not


null , address var

char(20) , desig varchar(20) , d_o_b date , d_o_j date , salary decimal(10,2));


Table created.


SQL> select * from emp57;


no rows selected


SQL> insert into emp57 values('01','MAYANK


SHARMA','BHAYANDAR','ENGINEER','04-AUG-89','20-AUG-08',20

000);


1 row created.


SQL> insert into emp57 values('02','ADITYA


LOHAI','BHAYANDAR','ENGINEER','04-AUG-89','20-AUG-08',150

00);


1 row created.


SQL> insert into emp57 values('03','BHUSHAN


TALEKAR','BHAYANDAR','ENGINEER','27-MAR-89','2-MAY-08',1

5000);


1 row created.


SQL> insert into emp57 values('04','SAURAB


SHETTY','DAHISAR','MANAGER','27-JAN-89','02-MAY-08',15000

);


1 row created.


SQL> insert into emp57 values('05','KHYATI


VASHI','BHAYANDAR','MANAGER','29-JAN-89','02-MAY-08',1500

0);


1 row created.


SQL> select * from emp57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000



SQL> create view manager57 as(select * from emp57);


View created.


SQL> select * from manager57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


SQL> create view peon57 as(select emp_id,emp_name from emp57);


View created.


SQL> select * from peon57;


EMP_ID EMP_NAME

---------- --------------------

01 MAYANK SHARMA

02 ADITYA LOHAI

03 BHUSHAN TALEKAR

04 SAURAB SHETTY

05 KHYATI VASHI


SQL> insert into emp57 values('06','SANKET


TANDEL','VASAI','ENGINEER','29-MAY-89','02-AUG-09',15000)

;


1 row created.


SQL> select * from emp57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


06 SANKET TANDEL VASAI ENGINEER

29-MAY-89 02-AUG-09 15000



6 rows selected.


SQL> select * from manager57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


06 SANKET TANDEL VASAI ENGINEER

29-MAY-89 02-AUG-09 15000



6 rows selected.



SQL> select * from peon57;


EMP_ID EMP_NAME

---------- --------------------

01 MAYANK SHARMA

02 ADITYA LOHAI

03 BHUSHAN TALEKAR

04 SAURAB SHETTY

05 KHYATI VASHI

06 SANKET TANDEL


SQL> create view manager57 as(select * from emp57);


View created.


SQL> select * from manager57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000



SQL> create view peon57 as(select emp_id,emp_name from emp57);


View created.


SQL> select * from peon57;


EMP_ID EMP_NAME

---------- --------------------

01 MAYANK SHARMA

02 ADITYA LOHAI

03 BHUSHAN TALEKAR

04 SAURAB SHETTY

05 KHYATI VASHI


SQL> insert into emp57 values('06','SANKET TANDEL','VASAI','ENGINEER','29-MAY-89','02-AUG-09',15000)

;


1 row created.


SQL> select * from emp57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


06 SANKET TANDEL VASAI ENGINEER

29-MAY-89 02-AUG-09 15000



6 rows selected.


SQL> select * from manager57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


06 SANKET TANDEL VASAI ENGINEER

29-MAY-89 02-AUG-09 15000



6 rows selected.


SQL> select * from peon57;


EMP_ID EMP_NAME

---------- --------------------

01 MAYANK SHARMA

02 ADITYA LOHAI

03 BHUSHAN TALEKAR

04 SAURAB SHETTY

05 KHYATI VASHI

06 SANKET TANDEL


6 rows selected.


SQL> SQL> select * from peon57;

SP2-0734: unknown command beginning "SQL> selec..." - rest of line ignored.

SQL>

SQL> EMP_ID EMP_NAME

SP2-0734: unknown command beginning "EMP_ID ..." - rest of line ignored.

SQL> ---------- --------------------

SQL> 01 MAYANK SHARMA

SQL> 02 ADITYA LOHAI

SQL> 03 BHUSHAN TALEKAR

SQL> 04 SAURAB SHETTY

SQL> 05 KHYATI VASHI

SQL> 06 SANKET TANDEL

SQL>

SQL>

SQL>

SQL>

SQL> insert into manager57 values('07','ASHOK JANGID','BHAYANDAR','ENGINEER','01-MAY-89','22-AUG-09'

,15000);


1 row created.


SQL> select * from manager57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


06 SANKET TANDEL VASAI ENGINEER

29-MAY-89 02-AUG-09 15000


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

07 ASHOK JANGID BHAYANDAR ENGINEER

01-MAY-89 22-AUG-09 15000



7 rows selected.


SQL> select * from emp57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


06 SANKET TANDEL VASAI ENGINEER

29-MAY-89 02-AUG-09 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

07 ASHOK JANGID BHAYANDAR ENGINEER

01-MAY-89 22-AUG-09 15000


7 rows selected.


SQL> select * from peon57;


EMP_ID EMP_NAME

---------- --------------------

01 MAYANK SHARMA

02 ADITYA LOHAI

03 BHUSHAN TALEKAR

04 SAURAB SHETTY

05 KHYATI VASHI

06 SANKET TANDEL

07 ASHOK JANGID


7 rows selected.


SQL> insert into peon57 values('08','ISHA VERMA');


1 row created.


SQL> select * from peon57;


EMP_ID EMP_NAME

---------- --------------------

01 MAYANK SHARMA

02 ADITYA LOHAI

03 BHUSHAN TALEKAR

04 SAURAB SHETTY

05 KHYATI VASHI

06 SANKET TANDEL

07 ASHOK JANGID

08 ISHA VERMA


8 rows selected.


SQL> select * from emp57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


06 SANKET TANDEL VASAI ENGINEER

29-MAY-89 02-AUG-09 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

07 ASHOK JANGID BHAYANDAR ENGINEER

01-MAY-89 22-AUG-09 15000


08 ISHA VERMA


8 rows selected.


SQL> select * from manager57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


06 SANKET TANDEL VASAI ENGINEER

29-MAY-89 02-AUG-09 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

07 ASHOK JANGID BHAYANDAR ENGINEER

01-MAY-89 22-AUG-09 15000


08 ISHA VERMA


8 rows selected.


SQL> create view secretary57 as(select emp_name,address from emp57);


View created.


SQL> select * from secretary57

2

SQL> select * from secretary57;


EMP_NAME ADDRESS

-------------------- --------------------

MAYANK SHARMA BHAYANDAR

ADITYA LOHAI BHAYANDAR

BHUSHAN TALEKAR BHAYANDAR

SAURAB SHETTY DAHISAR

KHYATI VASHI BHAYANDAR

SANKET TANDEL VASAI

ASHOK JANGID BHAYANDAR

ISHA VERMA


8 rows selected.


SQL> select * from emp57;


EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

01 MAYANK SHARMA BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 20000


02 ADITYA LOHAI BHAYANDAR ENGINEER

04-AUG-89 20-AUG-08 15000


03 BHUSHAN TALEKAR BHAYANDAR ENGINEER

27-MAR-89 02-MAY-08 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

04 SAURAB SHETTY DAHISAR MANAGER

27-JAN-89 02-MAY-08 15000


05 KHYATI VASHI BHAYANDAR MANAGER

29-JAN-89 02-MAY-08 15000


06 SANKET TANDEL VASAI ENGINEER

29-MAY-89 02-AUG-09 15000



EMP_ID EMP_NAME ADDRESS DESIG

---------- -------------------- -------------------- --------------------

D_O_B D_O_J SALARY

--------- --------- ----------

07 ASHOK JANGID BHAYANDAR ENGINEER

01-MAY-89 22-AUG-09 15000


08 ISHA VERMA


8 rows selected.


SQL> insert into secretary57 values('kusum sharma','miraroad');

insert into secretary57 values('kusum sharma','miraroad')

*

ERROR at line 1:

ORA-01400: cannot insert NULL into ("SYSTEM"."EMP57"."EMP_ID")






DBMS CLIENT SERVER PROGRAM


CLIENT SERVER PROGRAM

NAME JEKIN . J . TRIVEDI

CLASS : SE - IT ROLL NO : 67



CLIENT CODE

**********************************************************************************************************

Dim strdata As String





Private Sub Command1_Click()

If sock.State = sckClosed Then

sock.RemoteHost = "192.168.10.79"

sock.RemotePort = "50505"

sock.Connect

Else

sock.Close

End If

End Sub





Private Sub sock_Close()

sock.Close

End Sub



Private Sub sock_DataArrival(ByVal bytesTotal As Long)

sock.GetData strdata

Text2.Text = strdata



End Sub



Private Sub sock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)

MsgBox "SOCKET ERROR" & Number & ":" & Description

sock.Close





End Sub



Private Sub Text1_Change()

If sock.State = sckConnected Then

sock.SendData Text1.Text

End If

End Sub



*****************************************************************************************************************



SERVER CODE



Dim strdata As String





Private Sub Form_Load()

sock.Protocol = sckTCPProtocol

sock.LocalPort = "50505"

sock.Listen

End Sub



Private Sub sock_ConnectionRequest(ByVal requestID As Long)

If sock.State = sckListening Then

sock.Close

sock.Accept requestID

MsgBox "CONNECTED WITH" & sock.RemoteHostIP

End If

End Sub



Private Sub sock_DataArrival(ByVal bytesTotal As Long)

sock.GetData strdata

Text2.Text = strdata

End Sub





Private Sub sock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)

MsgBox "SOCKET ERROR" & Number & ":" & Description

sock.Close

sock.Listen

End Sub



Private Sub Text1_Change()

If sock.State = sckConnected Then

sock.SendData Text1.Text

End If

End Sub



************************************************************************************************************************

Tuesday, October 7, 2008

DSA INTERFACE

import java.io.*;

interface Area //interface defined
{
double pi=3.14F;
double compute(double x, double y);
}

class Rectangle implements Area
{
public double compute (double x, double y)
{
return(x*y);
}


}

class Triangle implements Area
{
public double compute(double x, double y)
{
return(0.5*x*y);
}
}
class InterfaceTest1
{
public static void main(String args[])
{
int f,e,k=0;
try {
DataInputStream x=new DataInputStream(System.in);
while(k<3)
{
System.out.println("Please enter ur choice:");
System.out.println("1.FIND AREA OF Triangle :");
System.out.println("2.FIND AREA OF RECTANGLE: ");
System.out.println("3.EXIT");
k=Integer.parseInt(x.readLine());
switch(k)
{
case 1:
System.out.println("ENTER THE BASE : ");
e=Integer.parseInt(x.readLine());
System.out.println("ENTER THE HEIGHT : ");
f=Integer.parseInt(x.readLine());
Triangle tri=new Triangle();
System.out.println("Area of Triangle : "+tri.compute(e,f));
break;
case 2:
System.out.println("ENTER THE LENGTH : ");
e=Integer.parseInt(x.readLine());
System.out.println("ENTER THE BREADTH : ");
f=Integer.parseInt(x.readLine());
Rectangle rect=new Rectangle();
System.out.println("Area of rectangle : "+rect.compute(e,f));
break;

case 3:
System.out.println("THANK U: ");
break;

}
}
}
catch(Exception w) {
System.out.println("EXCEPTION!!! ");
}

}
}
/*
Hi...this is first program based on interface
Area of rectangle : 50.0
*/

DSA QUICK SORT (REC)

/* Program to implement quick Sort (Recursive) */
/* Input:Unsorted Array
Output:Sorted Array */

import java.io.DataInputStream; // to load DataInputStream class

class QuickSortRec
{
public static void main(String args[ ])
{
int i,n=0;
int x[]=new int[25];
DataInputStream in = new DataInputStream(System.in);

try
{
System.out.print("Enter how many numbers to be sorted : ");
n = Integer.parseInt(in.readLine());
System.out.println("Enter "+n+" numbers in any order....");
for(i=0;i {
System.out.print("\t\tElement x["+(i+1)+"]=");
x[i] = Integer.parseInt(in.readLine());
}
}
catch(Exception e) { System.out.println("I/O Error"); }

quicksort(x,0,n-1,n); // Call to recursive quick sort
System.out.println("\nSorted Elements are :");
System.out.println("-----------------------------------");
display(x,n);
System.out.println("-----------------------------------");
}


//Recursive quick Sort Function

static void quicksort(int x[], int lb, int ub, int n)
{
int j=0;
if(lb>=ub)
return;
j=partition(x, lb, ub, j);
System.out.println("After partitioning array from index "+(lb+1)+" to "+(ub+1)+ " :\n ");
display(x,n);
quicksort(x, lb, j-1, n);
quicksort(x, j+1, ub, n);
} // end of recursive quick sort function

static int partition(int x[], int lb, int ub, int pj)
{
int a, down, temp, up;
a=x[lb]; // a is pivot element
up=ub;
down=lb;
while(down {
while(x[down]<=a && down down=down+1; //move up the array
while(x[up]>a)
up=up-1; //move down the array
if(down {
temp=x[down]; //interchange x[down]with x[up]
x[down]=x[up];
x[up]=temp;
}/*end if*/
}/* end while*/
x[lb]=x[up];
x[up]=a;
pj=up;
return (pj);
}/* end partition*/

static void display(int x[], int n)
{
int i;
System.out.println(" ");
for(i=0;i System.out.print("\t"+x[i]+ " ");
System.out.println(" ");
} // end of display function

}






DSA EXCEPTION HANDLING

/**
* @(#)Ehand.java
*
*
* @author
* @version 1.00 2008/10/6
*/

import java.io.*;
public class Ehand {

public static void main (String[] args) {
int a,b,c;
try {
DataInputStream x=new DataInputStream(System.in);

System.out.println("ENTER A: ");
a=Integer.parseInt(x.readLine());
System.out.println("ENTER B: ");
b=Integer.parseInt(x.readLine());
c=a/b;
System.out.println("A / B = "+c);
}
catch (ArithmeticException e){
System.out.println("ERROR DIVISION BY ZERO NOT POSSIBLE:");
}
catch(Exception e) {
System.out.println("EXCEPTION!!! ");
}
}

}

JTSEARCH