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'

No comments: