Home > database >  Very urgent! Please provide the original poster and masters to help you!
Very urgent! Please provide the original poster and masters to help you!

Time:09-28

The following script is to input data in the database table contract, but after the input data, can only show the original data, unable to display the content of the new input, please have a look, is there any wrong?

In addition: my another table staff, use the same script, input data, can display the contents of the new type, why can't the rest of contract form? Is very strange???

Long ll_id, ll_i
The date ld_open, ld_end
String ls_name ls_sex, ls_tel ls_idno, ls_company, ls_type, ls_city, ls_home
//data format test
If sle_id. Text="or" isnull (sle_id. Text) then
Messagebox (" missing data ", "please enter the number")
Sle_id. Setfocus ()
Return
Elseif sle_name. Text="or" isnull (sle_name. Text) then
Messagebox (" missing data ", "please enter the number")
Sle_name. Setfocus ()
Return
End the if

Ll_id=long (sle_id. Text)
//remove the sex selection

If rb_man. Checked=true then
Ls_sex=rb_man. Text
Elseif rb_woman. Checked=true then
Ls_sex=rb_woman. Text
End the if
//check if number with duplicate
The SELECT contract. Sta_id
INTO: ll_i
The FROM contract
WHERE contract. Sta_id=: ll_id;
If ll_i & lt;> 0 then
Messagebox (" error ", "no. The first" + string (ll_i) + "number with duplicate! Please correct, ")
Sle_id. Setfocus ()
Return
End the if
Ls_name=trim (sle_name. Text)
Ls_idno=trim (sle_idno. Text)
Ls_tel=trim (sle_tel. Text)
Ls_company=trim (sle_company. Text)
Ls_type=trim (sle_type. Text)
Ls_city=trim (sle_city. Text)
Ls_home=trim (sle_home. Text)
Ld_open=date ((sle_open. Text))
Ld_end=date ((sle_end. Text))
//contract to the database table input data
INSERT INTO "contract"
(" sta_id, "
"Name",
"Idno",
"Sex",
"Home",
"City",
"Type",
"Tel",
"Open",
"The end",
"Company",
"Remark")
VALUES
(: ll_id,
: ls_name,
: ls_idno,
: ls_sex,
: ls_home,
: ls_city,
: ls_type,
: ls_company,
: ls_tel,
: ld_open,
: ld_end,
: mle_remark. Text);
//after writing data, the input controls all empty
Sle_id. Text=""
Sle_name. Text=""
Sle_idno. Text=""
Sle_type. Text=""
Sle_company. Text=""
Sle_tel. Text=""
Sle_city. Text=""
Sle_home. Text=""
Sle_open. Text=""
Sle_end. Text=""
Mle_remark. Text=""
Sle_id. Setfocus ()//the cursor in the input field "number"

CodePudding user response:

It is ok to ask a question

CodePudding user response:

Just insert is not submitted, your application does not lock table?

CodePudding user response:

Long ll_id, ll_i
The date ld_open, ld_end
String ls_name ls_sex, ls_tel ls_idno, ls_company, ls_type, ls_city, ls_home
//data format test
If sle_id. Text="or" isnull (sle_id. Text) then
Messagebox (" missing data ", "please enter the number")
Sle_id. Setfocus ()
Return
Elseif sle_name. Text="or" isnull (sle_name. Text) then
Messagebox (" missing data ", "please enter the number")
Sle_name. Setfocus ()
Return
End the if

Ll_id=long (sle_id. Text)
//remove the sex selection

If rb_man. Checked=true then
Ls_sex=rb_man. Text
Elseif rb_woman. Checked=true then
Ls_sex=rb_woman. Text
End the if
//check if number with duplicate
The SELECT contract. Sta_id
INTO: ll_i
The FROM contract
WHERE contract. Sta_id=: ll_id;
If ll_i & lt;> 0 then
Messagebox (" error ", "no. The first" + string (ll_i) + "number with duplicate! Please correct, ")
Sle_id. Setfocus ()
Return
End the if
Ls_name=trim (sle_name. Text)
Ls_idno=trim (sle_idno. Text)
Ls_tel=trim (sle_tel. Text)
Ls_company=trim (sle_company. Text)
Ls_type=trim (sle_type. Text)
Ls_city=trim (sle_city. Text)
Ls_home=trim (sle_home. Text)
Ld_open=date ((sle_open. Text))
Ld_end=date ((sle_end. Text))
//contract to the database table input data
INSERT INTO "contract"
(" sta_id, "
"Name",
"Idno",
"Sex",
"Home",
"City",
"Type",
"Tel",
"Open",
"The end",
"Company",
"Remark")
VALUES
(: ll_id,
: ls_name,
: ls_idno,
: ls_sex,
: ls_home,
: ls_city,
: ls_type,
: ls_company,
: ls_tel,
: ld_open,
: ld_end,
: mle_remark. Text);


String ls_err
If the sqlca. Sqlcode=1 then
Ls_err=sqlca. Sqlerrtext
The rollback.
Messgebox (" ", ls_err)

The else
commit;
End the if


//after writing data, the input controls all empty
Sle_id. Text=""
Sle_name. Text=""
Sle_idno. Text=""
Sle_type. Text=""
Sle_company. Text=""
Sle_tel. Text=""
Sle_city. Text=""
Sle_home. Text=""
Sle_open. Text=""
Sle_end. Text=""
Mle_remark. Text=""
Sle_id. Setfocus ()//the cursor in the input field "number"

CodePudding user response:

Write that with other tools that better ah,

CodePudding user response:

Xys_777 eldest brother, I according to your modifications and rerun, still won't do, tip error, as is the value of input is wrong, alas... How to do?

CodePudding user response:

Whether the type of field and you do not match the type of insert, check the table structure

CodePudding user response:

Should not be the field type and the type of insert caused by inconsistent, another table because I can, why can't the rest of the table?
My field type, assignment, and define the types are as follows:
Long ll_id, ll_i
String ls_name ls_sex, ls_tel ls_idno, ls_company, ls_type, ls_city, ls_home
The date ld_open, ld_end

The field type assignment

Sta_id char, assignment is: ll_id
The name char, assignment is: ls_name
Idno char, assignment is: ls_idno
Sex char, assignment is: ls_sex
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related