Home > database >  VS2012 when connected to the Oracle using SQL statements
VS2012 when connected to the Oracle using SQL statements

Time:10-04

C + + :
Use SQL statements to the database in the VS2012 inserting data is as follows:
Insert into t_stu (stunum, stuname) values (stu. M_Num, stu. M_Name);

Including t_stu is to create good form, there are two fields: stunum, stuname
Stu is a Student class instantiation objects, m_Num, m_Name are members of the class variables, but such a written statement complains, the database has been successfully connected, could you tell me how to handle this, inside the parentheses as unrecognized stu is an object that will be handled as a string,

Only 30 points, all and wish you a great god help me, thank you.

CodePudding user response:

String SQL="insert into t values ('" + stu. M_Num + ", "+ stu. M_Name) + '
"

CodePudding user response:

You want the dynamic splicing,

PS: after finish these Suggestions, and then learn the bind variables;

CodePudding user response:

What is your mistake, a specific error,
Step by step debugging
Two variables

T1=stu. M_Num;
T2=stu. M_Name
Print whether two variables to see if the correct
Insert into t_stu (stunum, stuname) values (t1, t2);

Another mistake posted clear error message

CodePudding user response:

Using the method of parameterized

CodePudding user response:

Only look at you with a simple statement is no problem
Print statements, look into PLDEV execution, simple and clear
  • Related