--Flask-- --insert.py-- from flask import Flask,render_template, request from flask_mysqldb import MySQL app = Flask(__name__) app.config['MYSQL_HOST'] = 'localhost' app.config['MYSQL_USER'] = 'root' app.config['MYSQL_PASSWORD'] = '' app.config['MYSQL_DB'] = 'flask' mysql = MySQL(app) @app.route('/form') def form(): return render_template('form.html') @app.route('/login', methods = ['POST', 'GET']) def login(): if request.method == 'GET': return "hey!! accepted" if request.method == 'POST': no = request.form['id'] name = request.form['name'] cursor = mysql.connection.cursor() cursor.execute("INSERT INTO login (id,name) VALUES(%s,%s)",(no,name)) mysql.connection.commit() cursor.close() return "Done!!" app.run(debug=True) =============================================================================== --form.html-- Document

form data

id
name
=========================================================================================== --display.py-- from flask import Flask, render_template, request from flask_mysqldb import MySQL app = Flask(__name__) app.config['MYSQL_HOST'] = 'localhost' app.config['MYSQL_USER'] = 'root' app.config['MYSQL_PASSWORD'] = '' app.config['MYSQL_DB'] = 'flask' mysql = MySQL(app) @app.route('/retrive') def retrive_data(): Cursor = mysql.connection.cursor() Cursor.execute("select * from login") recordset = Cursor.fetchall() return render_template('display.html',data = recordset) @app.route('/select/') def select_data(idno): cursor = mysql.connection.cursor() cursor.execute("select * from login where id=%s", idno) recordset = cursor.fetchall() return render_template('update.html', data=recordset) @app.route('/update', methods = ['POST','GET']) def update_data(): if request.method == 'POST': no = request.form['id'] name = request.form['name'] cursor = mysql.connection.cursor() cursor.execute("update login set id = %s, name = %s where id = %s",(no, name, no)) mysql.connection.commit() return f"record update!!" @app.route('/delete/') def delete_data(idno): cursor = mysql.connection.cursor() cursor.execute("delete from login where id = %s", idno) mysql.connection.commit() cursor.close() return f"record delete!!" if __name__ == '__main__': app.run(debug = True) ============================================================================================== --display.html-- Document

Display Data

{% for row in data %} {% endfor %}
id name operation
{{ row.0 }} {{ row.1 }} update delete
=============================================================================================== ---php--- --connection-- ================================================================= --insert.php-- insert into test db
FEMALE MALE
C++ java PHP
============================================================================ --insquery.php-- ============================================================================ --insupdate.php-- update file
id name gender language course operation
id
name
gender checked = "checked" > Male checked = "checked" > Female
language c++ java php
course
========================================================================================== --insdelete.php-- ============================================================================================= ----UNIX----- --Reverse function-- echo -n "Enter a String: " read str k="a" if test -z "$str" then echo "String is Null" else len=${#str} printf "reverse string is:" while [ $len -gt 0 ] do echo -n "`echo $str | cut -c $len`" len=`expr $len - 1` done echo fi ============================================= --maximum size-- fname=`ls -lS | tr -s " " | grep '^-' | cut -d ' ' -f 9 | head -n 1` echo "File with max size is : $fname" echo "this is Contents of $fname : " echo cat $fname echo echo echo "Total no of lines in $fname = `wc -l < $fname`" echo "Total no of words in $fname = `wc -w < $fname`" echo "Total no of characters in $fname = `wc -c < $fname`" ===================================================== --calculator-- a=$1 b=$2 echo "number one is: $a" echo "number two is: $b" echo "Enter Choice :" echo "1. Addition" echo "2. Subtraction" echo "3. Multiplication" echo "4. Division" echo "5. Quit to unix" read ch case "$ch" in 1)add=`expr $a + $b` ;; 2)add=`expr $a - $b` ;; 3)add=`expr $a \* $b` ;; 4)add=`expr $a / $b` ;; 5)exit ;; *)echo "Invalid option" esac echo "Result : $add" ===================================================== --enter user valid name-- echo "Enter User Name"; read uname set `whoami | grep $uname` if [ $# -eq 0 ] then echo $uname "is Not Valid User! "; else echo $uname "is Valid User"; fi ================================================= ----asp.net---- --class file-- Imports Microsoft.VisualBasic Imports System.Data.OleDb Imports System.Data Public Class Class1 Dim cn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\asp.net practical\Database1.accdb") Dim cm As OleDbCommand Dim da As OleDbDataAdapter Dim ds As New DataSet Public Sub IUD(ByVal str As String) If cn.State = ConnectionState.Closed Then cn.Open() End If cm = New OleDbCommand(str, cn) cm.ExecuteNonQuery() cn.Close() End Sub Public Function Display(ByVal str As String) As DataSet da = New OleDbDataAdapter(str, cn) ds.Tables.Clear() da.Fill(ds) Return ds End Function End Class =========================================================== Imports System.Data Partial Class _Default Inherits System.Web.UI.Page Dim ds As New DataSet Dim s1 As New Class1 Dim str As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Page.IsPostBack = False Then ' fillcoursedata() ' fillstudata() End If fillcoursedata() fillstudata() End Sub Private Sub fillcoursedata() ds.Tables.Clear() ' ds = s1.Display("SELECT courseid, cname FROM coursemast") ds = s1.Display("SELECT * from coursemast") ddlcourse.DataSource = ds ddlcourse.DataTextField = "cname" ddlcourse.DataValueField = "courseid" ddlcourse.DataBind() End Sub Private Sub fillstudata() ds.Tables.Clear() ds = s1.Display("SELECT rno, sname, address, phone, email, gender, courseid FROM studentmast") GridView1.DataSource = ds GridView1.DataBind() End Sub Protected Sub btnadd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnadd.Click 'ds = s1.IUD("Insert into studentmast values(" & txtrno.Text & ",'" & txtname.Text & "','" & txtaddress.Text & "','" & txtphone.Text & "','" & txtemail.Text & "','" & rbtngender.SelectedValue & "','" & ddlcourse.SelectedValue & "')") 'Response.Redirect("~/Default.aspx") str = "Insert into studentmast(rno,sname,address,phone,email,gender,courseid) values(" & txtrno.Text & ",'" & txtname.Text & "','" & txtaddress.Text & "','" & txtphone.Text & "','" & txtemail.Text & "','" & rbtngender.SelectedValue & "'," & ddlcourse.SelectedValue & ")" s1.IUD(str) fillcoursedata() fillstudata() End Sub Protected Sub btnupdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnupdate.Click str = "Update studentmast Set sname='" & txtname.Text & "',address='" & txtaddress.Text & "',phone='" & txtphone.Text & "',email='" & txtemail.Text & "',gender='" & rbtngender.SelectedValue & "',courseid=" & ddlcourse.SelectedValue & " where rno=" & txtrno.Text & "" s1.IUD(str) 's1.IUD("Update studentmast set sname='" & txtname.Text & "',address='" & txtaddress.Text & "',phone='" & txtphone.Text & "',email='" & txtemail.Text & "',gender='" & rbtngender.SelectedValue & "',courseid=" & ddlcourse.SelectedValue & " where(rno=" & txtrno & ")") 'Response.Redirect("~/Default.aspx") End Sub Protected Sub btndelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btndelete.Click s1.IUD("Delete FROM studentmast where rno=" & txtrno.Text & "") Response.Redirect("~/Default.aspx") End Sub Protected Sub btngetdata_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btngetdata.Click ds = s1.Display("select * from studentmast where rno=" & txtrno.Text & "") txtrno.Enabled = False txtname.Text = ds.Tables(0).Rows(0).Item("sname").ToString txtaddress.Text = ds.Tables(0).Rows(0).Item("address").ToString txtphone.Text = ds.Tables(0).Rows(0).Item("phone").ToString txtemail.Text = ds.Tables(0).Rows(0).Item("email").ToString rbtngender.SelectedValue = ds.Tables(0).Rows(0).Item("gender").ToString ddlcourse.SelectedValue = ds.Tables(0).Rows(0).Item("courseid").ToString s End Sub End Class ========================================================