Worry of the Print statement in SQL

xiaoxiao2021-03-05  24

When writing a program a few days ago, I accidentally encountered a blame problem.

Symptoms are described as follows:

A SQL Server service is installed on a Lenovo server and writes a stored procedure in one of its databases. This stored procedure accepts a parameter, and the statement is judged to the parameters and then execute the branch.

IF @ CustType = 0

..................

Else IF @ CustType = 1

.......................

Else

...............

The basic structure is like this.

When I was developing, using the program on my notebook (Compara) to handle the RecordSet in the ADO in the program. When I execute it to rsopen, there is no problem. I use it on the server. There is no problem with this program to perform call stored procedures, everything is normal.

However, when using the same program to access other computers, use the same program to access the first case during the stored procedure, all the forms are automatically turned off, nor any abnormal appearance.

There is also a special situation, because this problem has been there on one of the Lenovo machines, later I went to see this question, can't find the reason. So I installed VS6 on this computer, on-site debugging, but I debugged Everything is normal, after a month, there is an original problem (form completely closed)

This problem is big. The same program is sometimes normal when performing different computers, and I believe it is absolutely no mistake. I think it may be a problem with the computer. So when a computer is heavy, try again, Or not.

If you think about it, you will not be hit, and you will have all SP installed in the nearly two hours. Still not normal. Install the VS6 again, it is useless. Where is it? I think about it carefully, I once thought Will it be a problem with Lenovo's break, it will not be his CPU instruction. (Because the machine is older, then this problem has never had this problem on other computers). I tried the first kind in the program. The value of the situation changes, it is 0, it is changed to 3 this. So I change IF @ CustTy = 0 in the stored procedure to IF @ CustType = 3. The problem has appeared. Will not have problems appear in this branch The logic inside is definitely right. See this branch finally has a line of code, this code is used in debugging. When you use the stored procedure to execute, what is the statement, which is a statement, which is a print (@SQLSTR) Will it be caused by this statement. Comment it it). Open the program and try again. By the computer with the computer.

It turns out that this problem is caused by a print statement. Blame blame does not have problems when some clients are executed. And there is no abnormality when there is a problem, just automatically shut down the client form. It seems that the program is written later Be sure to pay attention to this problem. To clean the debug code. Harm my white flowers for a day.

转载请注明原文地址:https://www.9cbs.com/read-36052.html

New Post(0)