Home > database >  About the pb to insert data in the table in question!!!!!!!!!! Please help!!!!!! Thank you very much
About the pb to insert data in the table in question!!!!!!!!!! Please help!!!!!! Thank you very much

Time:10-06

Pb, please help!!!!!!
Is what I use is pb8, database access
Now want to import the data through the data window, but want to show after import article updated data for
Import data for dbase3, due to the possible import more data than the data in the system to add or update the data, so want to through some way to pick out the updated data (compared with the original database table), and statistical number,
The import button script is as follows:
Including dw_1 to show the data import process window
Dw_2 to accept incoming data window, submitted to the database in cjk_info_temp
Dw_1. Settransobject (sqlca)
Dw_1. Retrieve ()
//delete data in a temporary table
The delete from cjk_info_temp using the sqlca.
Dw_1.object.com pute_1. Visible=true
Dw_1. Object. T_2. Visible=true
Dw_2. Settransobject (sqlca)
If dw_2. Importfile (docname) & lt;=0 then
Messagebox (" warning: "' an error occurred when execute importfile function... ')
End the if
Dw_2. Accepttext ()
If dw_2. The update () & lt;> 1 then
Messagebox (" warning: "' an error occurred when saving data: + sqlca. Sqlerrtext + '... ')
The rollback using sqlca;
The else
Commit the using the sqlca;
End the if
Dw_1.object.com pute_2. Visible=true
Dw_1. Object. T_3. Visible=true

Long ks_cj zy_cj, ps_cj, sum, I
String db_nj db_jxd, db_xj db_xh, db_xm, db_zy, db_kc
Sum=dw_2. Rowcount ()
For I=1 to sum
//will result the imported result is greater than the original record in the database data inserted into a temporary table (db_temp)
//in order to count
insert into db_temp
The select cjk_info_temp. Nj, cjk_info_temp JXD, cjk_info_temp. XJDM, cjk_info_temp. Xh, cjk_info_temp. Xm, cjk_info_temp. BZDM, cjk_info_temp. KCDM, cjk_info_temp. Kscj2, cjk_info_temp. Zycj2, cjk_info_temp. Pscj2 from cjk_info_temp, t_cjk_temp
Where cjk_info_temp. Xh=t_cjk_temp. Xh and cjk_info_temp. KCDM=t_cjk_temp. KCDM and cjk_info_temp. Kscj2 & lt;> T_cjk_temp. Kscj2;
next
Is the above steps are not completed, db_temp't insert data into
Please help!! Thank you!!

CodePudding user response:

Type sqlcode and sqlerrtext out looking for reason

CodePudding user response:

Thank you for your reminding, I try!

CodePudding user response:

Tried, there are no mistakes, depressed! I don't know whether to write the condition of no, so lead to not cut into the data,

CodePudding user response:

1,
The select cjk_info_temp. Nj, cjk_info_temp JXD, cjk_info_temp. XJDM, cjk_info_temp. Xh, cjk_info_temp. Xm, cjk_info_temp. BZDM, cjk_info_temp. KCDM, cjk_info_temp. Kscj2, cjk_info_temp. Zycj2, cjk_info_temp. Pscj2 from cjk_info_temp, t_cjk_temp
Where cjk_info_temp. Xh=t_cjk_temp. Xh and cjk_info_temp. KCDM=t_cjk_temp. KCDM and cjk_info_temp. Kscj2 & lt;> T_cjk_temp. Kscj2
No results, try to perform the alone

2, whether performed not submitted, commit try

3, the next cycle is what role?
For I=1 to sum
//will result the imported result is greater than the original record in the database data inserted into a temporary table (db_temp)
//in order to count
Insert into db_temp
The select cjk_info_temp. Nj, cjk_info_temp JXD, cjk_info_temp. XJDM, cjk_info_temp. Xh, cjk_info_temp. Xm, cjk_info_temp. BZDM, cjk_info_temp. KCDM, cjk_info_temp. Kscj2, cjk_info_temp. Zycj2, cjk_info_temp. Pscj2 from cjk_info_temp, t_cjk_temp
Where cjk_info_temp. Xh=t_cjk_temp. Xh and cjk_info_temp. KCDM=t_cjk_temp. KCDM and cjk_info_temp. Kscj2 & lt;> T_cjk_temp. Kscj2;
Next

CodePudding user response:

If something wrong happens to submit, sqlerrtext must be content

There is no content to the building Lord, look at the sqlca. The autocommit mode has been set to true? Set to true, the pb will automatically put it commit or rollback, sqlerrtext value will only be at this time a commit or rollback the success of the value, of course no content

Set it to false, then check the sqlerrtext after your statements

CodePudding user response:

Insert into db_temp
The select cjk_info_temp. Nj, cjk_info_temp JXD, cjk_info_temp. XJDM, cjk_info_temp. Xh, cjk_info_temp. Xm, cjk_info_temp. BZDM, cjk_info_temp. KCDM, cjk_info_temp. Kscj2, cjk_info_temp. Zycj2, cjk_info_temp. Pscj2 from cjk_info_temp, t_cjk_temp
Where cjk_info_temp. Xh=t_cjk_temp. Xh and cjk_info_temp. KCDM=t_cjk_temp. KCDM and cjk_info_temp. Kscj2 & gt; T_cjk_temp. Kscj2;
If the sqlca. Sqlcode<> 0 then
Messagebox (" warning: ", "the data inserted into a formal table failed!" + the sqlca. Sqlerrtext)
The rollback using sqlca;
End the if
Commit the using the sqlca;
I have already done so, according to what you said, but there is no error message! Ha ha! But good thank you! Also help me to find problems, I'm try! Hee hee ~

CodePudding user response:

The cycle is to make every data comparison of the two tables, then find out the scores, the new rewrite is a table in the database,
I now is not clear how should compare the two tables in the data, is the student id and course of the same students performance comparison between in the two tables, is the place I feel there is something wrong with, but don't know how to change!

CodePudding user response:

I don't want to wrong, circulation, an Epiphany! Thank you for your reminding, but I think I should still have a problem I query conditions, if I remove cjk_info_temp kscj2 & gt; T_cjk_temp kscj2 this sentence can be submitted to success! Nothing but add not, oh,

CodePudding user response:

In fact, it is because it was the kscj2 column in the table that I had no any data, so can't compare, will can be carried out after they are changed to 0, no matter how to thank you all!
  • Related