Home > database >  O great god look good code, sincerely for advice!
O great god look good code, sincerely for advice!

Time:10-22

I entered PB, is trying to do an information system, at present registered user interface is always unable to realize, I just to join this BBS is no reward for capital, asked the man to help change, in this thank humbly!
String (p1, p2, p3, p4, p5
String id
P1=trim (sle_1. Text)
The p2=trim (sle_2. Text)
P3=trim (sle_3. Text)
P4=trim (sle_4. Text)
P5=trim (ddlb_1. Text)
If p1="" then
Messagebox (" prompt ", "user ID can't be empty!" )
End the if
If p2="" then
Messagebox (" prompt ", "user name cannot be empty!" )
End the if
If p3="" then
Messagebox (" prompt ", "password cannot be empty!" )
End the if
If p3 & lt;> P4 then
Messagebox (" prompt ", "two password do not match!" )
Sle_3. Text=""
Sle_4. Text=""
Sle_3. Setfocus ()
End the if

Select "user list". "user ID" INTO: ID
From the user table ""
Using the sqlca.
If id=p1 then
Messagebox (" prompt ", "this user ID has been exist")
Sle_1. Text=""
Sle_2. Text=""
Sle_3. Text=""
Sle_4. Text=""
Sle_1. Setfocus ()
Return
End the if
INSERT INTO "user table
"(" user id ",
"User name",
"Password",
"Authority")
VALUES (: p1,
: p2,
: p3,
: (p5);

CodePudding user response:

New post as second sink?

CodePudding user response:

His top! His top! His top! His top!

CodePudding user response:

Hard top ~ top ~ top ~ top hard hard hard ~

CodePudding user response:

Each prompt return statements after
If p1="" then
Messagebox (" prompt ", "user ID can't be empty!" )
Return
End the if

CodePudding user response:

The end to transaction commit
Commit the using the sqlca;

CodePudding user response:

At present registered user interface is always unable to achieve

What problem?

Put a return at the end of messagebox, otherwise will also perform down

Beginners should use a order step debugging

CodePudding user response:

No description clear problem

CodePudding user response:

Then add
If the sqlca. Sqlcode=0 then
Commit;
Messagebox (" prompt ", "note delete successful")

The else
The rollback.
Messagebox (" prompt ", "note delete failed" + sqlca. SQLErrText)
End the if

CodePudding user response:

Select the lack of a where clause
Long ll_count
Select count (*) into: ll_count from the users table where the user id=p1
If ll_count & gt; 0 then
.
End the if

CodePudding user response:

I just want to see, my grades didn't come back on the

CodePudding user response:

There are a few problems
The first local variable naming rules, general and local variable string begins with ls_, instance variables begin with is_, id do not know will not go wrong
String (p1, p2, p3, p4, p5
String id
P1=trim (sle_1. Text)
The p2=trim (sle_2. Text)
P3=trim (sle_3. Text)
P4=trim (sle_4. Text)
P5=trim (ddlb_1. Text)
With the second also, and the general judgment is empty basic lenth () judgment p1='may have holes
And your statement messagebox error, how don't return statement execution, or four messagbox wants to fly out,
Seems the webmaster is not to run the program, in fact, a run will know the results
If p1="" then
Messagebox (" prompt ", "user ID can't be empty!" )
End the if

//the third this select best
The select cout (*) into: li_count from "user table
"Where "user ID"=ID, whether li_count than is ok,
If the user has a lot of data in the table, select which one are you? Ha ha
Select "user list". "user ID" INTO: ID
From the user table ""
Using the sqlca.
If id=p1 then
Messagebox (" prompt ", "this user ID has been exist")
Sle_1. Text=""
Sle_2. Text=""
Sle_3. Text=""
Sle_4. Text=""
Sle_1. Setfocus ()
Return
End the if
//4 insert statement did not commit, other have no prompt to appear failure didn't response
INSERT INTO "user table
"(" user id ",
"User name",
"Password",
"Authority")
VALUES (: p1,
: p2,
: p3,
: (p5);
To sum up, the feeling is the webmaster is not very understand what call using the sqlca, SQL remains to be strengthen

CodePudding user response:

The 12th floor said more detailed

Select "user list". "user ID" INTO: ID
From the user table ""
Using the sqlca.
If id=p1 then
Messagebox (" prompt ", "this user ID has been exist")

In this for this code to do a show, a select statement, as you write so, the result is that all user ID, and then if you judge is of single variable judgment, you are always is the first user ID in the database,

1, select lack the where statement;
2, using the sqlca is the use of your programs use a database of the much more, will appear, if only with a single database, the default is not to add this sentence,

The road is long, hard!

CodePudding user response:

The positive solution, upstairs

CodePudding user response:

Leave a footprint, to see how great god is help beginners to analyze problems,

CodePudding user response:

Select "user list". "user ID" INTO: ID
From "user list" to add the WHERE condition

CodePudding user response:

Leave a footprint, to see how great god is help beginners to analyze problems,

CodePudding user response:

Just hours all love make such a mistake, that's all right, be familiar with

CodePudding user response:

Leave a footprint, to see how great god is help beginners to analyze problems,
  • Related