Home > database >  Connecting two databases, oracle and SQL to convert each other, the information results conversion f
Connecting two databases, oracle and SQL to convert each other, the information results conversion f

Time:10-20



Here is a copy button code:
Int li_i//rowscopy return value variable
Int li_j//dw_2 last line by line,
Int I//loop variable
Boolean b_sqlcode=false
String id, the classname, sex, which


String wid []//define a string array or dw_1 SAMPLENO column data
Int li_updata//updata function return value variable
Li_j=dw_2. Rowcount ()//initialization li_j dw_2 last line
Int li_dw1
Li_dw1=dw_1. Rowcount ()
If li_j=0 then//dw_2 if the data is the first line is assigned to him
Li_j=1
End the if
For I=1 to add modify data li_dw1//cycle, if the SQL database has the sid to modify primary key data, if there is no primary key data sid will add
Id=string (dw_1. Object. Id [I])
The classname=string (dw_1. Object. The classname [I])
Sex=string (dw_1. Object. Sex [I])
Which=the string (dw_1. Object. Which [I])
//sid=int (dw_1. Object. Sid [I])
//select the sid into: sid from student where sid=: sid using the sqlca.//query SAMPLENO
//if the sqlca. Sqlcode=0 then
//update the sid set stuname=: sname, stusxe=: sxe, stuage=: sage where stuname=: sname using the sqlca.
Insert into classes values (id: the classname, : sex, : which) using the sqlca.
If the sqlca. Sqlcode=0 then
Commit the using the sqlca;
B_sqlcode=true
The else
The rollback using sqlca;
B_sqlcode=false
End the if
//end if

If the sqlca sqlcode=100 then//if not add
Li_i=dw_1. Rowscopy (I, I, primary! Dw_2, li_j, primary!
Li_updata=(https://bbs.csdn.net/topics/dw_2.update)
If li_updata=https://bbs.csdn.net/topics/1 then
B_sqlcode=true
The else
B_sqlcode=false
End the if
Dw_1. Retrieve ()
End the if
Next
If b_sqlcode=true then
Messagebox (" prompt ", "success!" )
The else
MessageBox (" prompt ", "fail!" )
End the if

CodePudding user response:

Brothers, run which lines of code to make a mistake? What error message?

CodePudding user response:

Every time is you ~ good excited

CodePudding user response:

Did not show error is copy not to success

CodePudding user response:

Have a look at the sqlca after the UPDATE. Sqlerrtext, there is error message, according to the error information to deal with
  • Related