Some time we need to select just one max row from data base so that we increment in it and use for the next id so here is the simple solution of it in php
Today Pageviews
Facebook Page
Featured Post
Upload file from URL to Server using cURL in PHP
This Post show how to upload data or audio files on server getting from URL and how to download that file in PC using URL. First put URL...
Categories
- Data Structure
- C++
- Interesting Programs
- programming
- Assembly Language
- COAL
- web development
- tree
- html
- css
- Article's
- web designing
- php
- C Programming
- C#
- Data base
- java-script
- Android
- Java
- liner algabra
- Sorting
- .net
- Queue
- SQL
- link list
- Projects
- Stack
- Interfaces
- advance
- Matlab
- ajax
- heap
- jquery
- xml
- E-books
- computer tricks
- vb.net
Pages
Labels
Data Structure
(57)
C++
(52)
Interesting Programs
(50)
programming
(32)
Assembly Language
(31)
COAL
(31)
web development
(31)
tree
(24)
html
(22)
css
(21)
Article's
(20)
web designing
(20)
php
(17)
C Programming
(15)
C#
(15)
Data base
(11)
java-script
(10)
Android
(9)
Java
(9)
liner algabra
(9)
Sorting
(8)
.net
(7)
Queue
(7)
SQL
(7)
link list
(7)
Projects
(6)
Stack
(5)
Interfaces
(4)
advance
(3)
Matlab
(2)
ajax
(2)
heap
(2)
jquery
(2)
xml
(2)
E-books
(1)
computer tricks
(1)
vb.net
(1)
Facebook Profile
Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts
Saturday, December 3, 2022
Thursday, November 10, 2022
How to delete data in C# from sql database : code in c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Data;
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
SqlConnection cnn = new SqlConnection(@"Data Source=localhost\SQLExpress;Initial Catalog=awais;Integrated Security=True;Integrated Security=True ");
cnn.Open();
string query = "delete from logout where name = '" +TextBox1.Text+ "';";
SqlCommand cmd = new SqlCommand(query, cnn);
cmd.ExecuteNonQuery();
Response.Write("Deletion is done!");
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Data;
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
SqlConnection cnn = new SqlConnection(@"Data Source=localhost\SQLExpress;Initial Catalog=awais;Integrated Security=True;Integrated Security=True ");
cnn.Open();
string query = "delete from logout where name = '" +TextBox1.Text+ "';";
SqlCommand cmd = new SqlCommand(query, cnn);
cmd.ExecuteNonQuery();
Response.Write("Deletion is done!");
}
}
}
Friday, November 4, 2022
Friday, November 27, 2015
Up-Date record in SQL Database using C#.net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Data;
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button3_Click(object sender, EventArgs e)
{
SqlConnection cnn = new SqlConnection(@"Data Source=localhost\SQLExpress;Initial Catalog=awais;Integrated Security=True;Integrated Security=True ");
cnn.Open();
string query = "update logout set name ='"+TextBox3.Text+"' where name = '" + TextBox2.Text + "';";
SqlCommand cmd = new SqlCommand(query, cnn);
cmd.ExecuteNonQuery();
Response.Write("update is done!");
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Data;
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button3_Click(object sender, EventArgs e)
{
SqlConnection cnn = new SqlConnection(@"Data Source=localhost\SQLExpress;Initial Catalog=awais;Integrated Security=True;Integrated Security=True ");
cnn.Open();
string query = "update logout set name ='"+TextBox3.Text+"' where name = '" + TextBox2.Text + "';";
SqlCommand cmd = new SqlCommand(query, cnn);
cmd.ExecuteNonQuery();
Response.Write("update is done!");
}
}
}
Sunday, November 2, 2014
Create Foreign key in Sql
How To create Foreign key in sql table :
You have a code(for table)like this:
create table person( name varchar2(5),
Id_no number(3),
Address number(10) );
and you have another table of place:
create table place(name varchar2(5)primary key,
location varchar2(5),
owner_name varchar2(5) );
Column Order:
create table place(name varchar2(5) primary key,
location varchar2(5),
owner_name varchar2(5) references person(name) );
==================================================
Table Order:
create table place(name varchar2(5) primary key,
location varchar2(5),
owner_name varchar2(5),
constraint n_pk foreign key (owner_name) references person(name) );
Note:All the bold words are reserved word in Sql.
You have a code(for table)like this:
create table person( name varchar2(5),
Id_no number(3),
Address number(10) );
and you have another table of place:
create table place(name varchar2(5)primary key,
location varchar2(5),
owner_name varchar2(5) );
Now you want to make owner_name as Foreign key which relate name of person to the owner name of place table. so there are two methods to make a column foreign key one in table order and other one is column order.
===================================================Column Order:
create table place(name varchar2(5) primary key,
location varchar2(5),
owner_name varchar2(5) references person(name) );
==================================================
Table Order:
create table place(name varchar2(5) primary key,
location varchar2(5),
owner_name varchar2(5),
constraint n_pk foreign key (owner_name) references person(name) );
Note:All the bold words are reserved word in Sql.
See Also :How to create Primary Key in data base table using Sql Command.
Create Primary Key in Sql table
How To create primary key in sql table :
You have a code(for table)like this:
create table person( name varchar2(5),
Id_no number(3),
Address number(10));
Now you want to make Id_no as Primary key: so there are two methods to make a column primary key one in table order and other one is column order.
===================================================
Column Order:
create table person( name varchar2(5),
Id_no number(3) primary key,
Address number(10));
==================================================
Table Order:
create table person( name varchar2(5),
Id_no number(3),
Address number(10),
primary key(Id_no));
You have a code(for table)like this:
create table person( name varchar2(5),
Id_no number(3),
Address number(10));
Now you want to make Id_no as Primary key: so there are two methods to make a column primary key one in table order and other one is column order.
===================================================
Column Order:
create table person( name varchar2(5),
Id_no number(3) primary key,
Address number(10));
==================================================
Table Order:
create table person( name varchar2(5),
Id_no number(3),
Address number(10),
primary key(Id_no));
Create Table in Sql
How to create table in sql:-
The create table statement is used to create a new table.
Example:
create table employee
(first varchar(15),
last varchar(20),
age number(3),
address varchar(30),
city varchar(20),
state varchar(20));
To create a new table, enter the keywords create table followed by the table name, followed by an open parenthesis, followed by the first column name, followed by the data type for that column, followed by any optional constraints, and followed by a closing parenthesis. It is important to make sure you use an open parenthesis before the beginning table, and a closing parenthesis after the end of the last column definition. Make sure you seperate each column definition with a comma. All SQL statements should end with a ";".
Here are the most common Data types:
char(size) | Fixed-length character string. Size is specified in parenthesis. Max 255 bytes. |
varchar(size) | Variable-length character string. Max size is specified in parenthesis. |
number(size) | Number value with a max number of column digits specified in parenthesis. |
date | Date value |
number(size,d) | Number value with a maximum number of digits of "size" total, with a maximum number of "d" digits to the right of the decimal. |
See Also: How To Create Primary Key in Sql table
See Also: How to create Foreign Key Using Sql Command
Subscribe to:
Posts (Atom)
Pages
- Home
- C++ final projects
- Programming Examples
- OOP final projects
- Hacking tricks :-
- C Programming Examples
- OOP Programming Examples
- JAVA
- Simple C program
- Typing Tutor in C++
- Tic-Tac-Toe in C++
- E-Books for C Language
- E-Books for C++ Language
- E-Books for JAVA Language
- E-Books for OOP in C++
- C final Projects
- New Posts
Labels
- .net (7)
- advance (3)
- ajax (2)
- Android (9)
- Article's (20)
- Assembly Language (31)
- C Programming (15)
- C# (15)
- C++ (52)
- COAL (31)
- computer tricks (1)
- css (21)
- Data base (11)
- Data Structure (57)
- E-books (1)
- heap (2)
- html (22)
- Interesting Programs (50)
- Interfaces (4)
- Java (9)
- java-script (10)
- jquery (2)
- liner algabra (9)
- link list (7)
- Matlab (2)
- php (17)
- programming (32)
- Projects (6)
- Queue (7)
- Sorting (8)
- SQL (7)
- Stack (5)
- tree (24)
- vb.net (1)
- web designing (20)
- web development (31)
- xml (2)