Summary of STAFF INFO Small System

xiaoxiao2021-03-06  41

// DB

Create Table

CREATE TABLE STAFF

No varchar2 (8) Primary Key Not Null,

Name varchar2 (32) Not null,

Username varchar2 (32) Not null,

Sex varchar2 (4) Not null,

BDEP VARCHAR2 (32) Not null,

Dep varchar2 (32) Not null,

Marry varchar2 (8),

Bir varchar2 (16),

Edu varchar2 (16),

INTEREST VARCHAR2 (512),

Skill varchar2 (512),

Introduce Varchar2 (1024));

INSERT INFO

INSERT INTO Staff Values ​​('TN1133', 'Su Moon ",' Aaron ',' M ',' Management Office ',' Netcom Information Department ',' N ','

1980-03-01

',' Jun, 'book', 'Computer', 'I Want Love Very Much';

INSERT INTO Staff Values ​​('TN0642', 'Li Yongliang', 'Kevin', 'M', 'Management ",' Netcom Information Department ',' N ','

1976-09-09

',' Jun, 'book', 'Computer', 'I Want Love Very Much';

COMMIT;

Drop Staff:

Drop Table Staff;

DROP INFORMATION:

Delete from staff where no like '%'

Update:

String update = "Update Staff"

"SET Interest = '" Interest ", Skill ='" Skill ", Introduce = '" Introduce ""

"where username = '" username "'";

Some main statements:

// Set session, for the first time

Request.SetCharacterencoding ("BIG5");

HttpSession se = request.getsession ();

String Username = Request.getParameter ("UserName");

Se.setttribute ("UserName", UserName;

// Get session

HttpSession se = request.getsession ();

String username = (string) SE.GETATTRIBUTE ("UserName");

Out.println (username ", this is the information you want to query:");

// Delete session

HttpSession se = request.getsession ();

String username = (string) SE.GETATTRIBUTE ("UserName"); SE.RemoveAttribute ("UserName");

/ / Compare the annoying value: page jump to the query page (set the session page, you must take the parameters !!!)

Modify my details

Return to re-query

Program experience:

1. When returning from a page to the previous page, the session problem:

Return to the previous page to query

2. Write to the end of the last time, discover the username in the user name and database, usually log in to English, and the real name in the database is Chinese! You need to add a field, it is not considered when the system starts. thoughtful,

3. When writing to modify the information, I can't make any data to be modified, I think about it, this is the understanding and The understanding is not thorough enough, since I want to pass the modified information, I want to ignore the key value (No), used for the WHERE of the SQL statement, but Submit doesn't have a parameter, what should I do?????

At this time, I thought of the session, nor I just understood the session from the statement. From the session, Isername, the SQL statement was revised, but the result was successful, but the problem I faced is that if there are two usernames, it is not possible. Because of the modification, the two username's information must be modified! But think of the general system seems to have two identical login names, so I am lucky!

I have to think about it carefully. What can sessions play? I have reasonable choice of PK when I build Table, not for the application! This sentence is more troublesome, that is, said

Username varchar2 (32) Not null,

No varchar2 (8) Primary Key Not Null,

You should set UserName as Primary Key, but the reality is not repeated. How do I control the card number does not repeat? Or should I read a database again, is it integrity?

Every time I have a small system, there are different gains. Sometimes I often make mistakes in the past. But this time I have a debugging and modification is really tired, but I have been progressing, including HTML, JDBC, Oracle. Understanding, thinking that Oralce, I haven't written the database transaction, I don't know if I don't have a database transaction, where is the information changed?

Boolean AutoCommit = conn.getautocommit ();

Finally {

Conn.setautocommit (AutoCommit);

CONN.CLOSE ();

}

I added these to the code, and I have appeared java.lang.nullpointerException

I don't know why, I really don't want to work hard today.

Write a small system in this week, learning to apply session, as well as JDBC data source connection, a bit complacent, haha.

Tomorrow, I have to go home, I am a bit happy, I have been very useful, I have worked hard to write a small system. Before and after, the database Table has changed three times. How many changes have been changed? Place, it seems that systematic analysis is very important, and there are few more detours! This is hard, very tired, and very happy.

转载请注明原文地址:https://www.9cbs.com/read-59964.html

New Post(0)