Home > Software engineering >  Why my VB database where death is operation error, seek to reassure and haven't done to find in
Why my VB database where death is operation error, seek to reassure and haven't done to find in

Time:09-18



CodePudding user response:

CodePudding user response:

You want to query is "combo1. Text" field is equal to "combo2. Text field records," the database but you can't be "combo1. Text" and "combo2. Text fields," the final SQL statement should be on "spell" out, you shall take the combo1. The value of the text together again to the string, rather than the combo1. Directly to the text this expression as a string in, pay attention to the difference between the expression itself and the value of the expression,
 "select * from inventory table where" & amp; Combo1. Text & amp; "='" & amp; Combo2. Text & amp; "'" 

CodePudding user response:

All commented On the Error Resume Next statement, in VB6 IDE,
The error and then click the debugging, the cursor will stop error in the statement,
Or
In doubt may have a logical error statements in advance to set breakpoints, run through the breakpoint interrupt,

At this point can be used in the immediate window
? The variable name
Or
? The function name () function parameter
Or
Process (parameters)
Auxiliary debugging,

CodePudding user response:

The building Lord questions posture has a problem,

Should be like this:
1, bask in a database table structure, if you do not understand, away from programming,
2, bask in the text version of the code, rather than just pictures,
3, bask in the text version of the code, need to format, in type, and use the code coloring, if not, please payment to help you,
4, tell everyone what are you control, control what name,

CodePudding user response:

If the field is character:
Rec. Open the "select * from inventory table where" & amp; Combo1. Text & amp;"='" & amp; Combo2. Text & amp;" '
"If the field is numeric:
Rec. Open the "select * from inventory table where" & amp; Combo1. Text & amp;"="& amp; Combo2. Text & amp;" "

CodePudding user response:

The field name in Chinese and the manual hardcoded, the database will have to change the code, code must also change the database...

Press F5 to explain run, error when the wrong positioning in that statement, and then targeted search.

Most in language use are not familiar with the problem of all belong to the 5 minutes can solve.

CodePudding user response:

The sixth floor already shows the code

CodePudding user response:

Send execution of SQL statements in the form of a string, if some of the other part to use dynamic variable value, must be in double quotes outside with connector & amp; Connect to the entire statement,

If you refer to these variables in double quotes, delivery is just the name of these variables,
  • Related