Summary of errors that may occur during execution of Stored Procedures
Chang jianzhao
When I wrote my homework some time ago, I used a lot of stored procedures, and there were also a lot of errors when calling stored procedures. In addition, many mistakes cannot be made once .. A waste of one or two hours at a time ,.. Now let's make a summary. We hope that when you encounter a storage process call error and the data layer does not return data, it will generate problems such as nullreferenceexception. If you have no clue, we can compare them, can you give me some advice ..
Note: This summary does not mean all possible errors .. It's just a mistake I 've made. Maybe you think it's very low-level, but the low-level mistake is that the old Gates will also make it ..
I have made four major mistakes:
1.Specifies the spelling of the stored procedure name.
This is the lowest possible mistake. I used to spend most of my time searching for errors .. When I found that the name of the stored procedure was spelled wrong, I did... There is still a trap on the iron cabinet in the lab...
2.When stored procedure is called,CodeWrite an error.
When calling these cute stored procedures in your code, be careful that your code is correctly executed. For example, on your data layer, you are using the call method you have written. Pay attention to the 1st error, pay attention to the returned type, and pay attention to the parameter format; if you are too lazy and require secure calling methods (such as me,), Microsoft's Microsoft Data Access application block will be used. At this time, you need to pay attention to the method used to call the stored procedure, see the type returned by the method and the parameters of the method. Select a suitable method to make full use of the block efficiency.
3.Web service reference error
If you do not use web service, skip this step, but we recommend that you take a look, because you will definitely use web service in the future. Note that the Web reference must be updated in a timely manner after each change. Otherwise, it will be very embarrassing... If you have multiple web services, make sure to update your web reference ..... Here I want to emphasize that smart device and ASP. net web service references are different. Smart device uses. NET Compact framework, while ASP. net is.. NET Framework.ArticleIn a short time, I will write more detailed explanations. The error I made here is that the Web service cannot be connected due to a web service reference error during the design of my PPC client ., another error occurs because platformnotsupportedexception occurs in the returned dataset. net vs is used to develop English PPC in Chinese OS. The solution is to refresh the data's cultureinfo attribute. (Note: The Web service only supports the returned dataset, and does not support data such as datatable)
4.Permission problems
This is the most irritating. Everything seems to be normal. It's totally correct, but it cannot be executed. In the end, we found that we forgot to set the permission for the stored procedure .. It's really depressing .. I am using SQL Server 2000, and the permission settings are in your stored procedure .. Don't forget, after creating a stored procedure each time, you 'd better check the permission. It is very convenient to press a button, but it can ensure that you will not spend one or two hours checking other errors...
Well, the above is the problem related to calling the stored procedure in this job. Hope to help you. At the same time, if you have encountered other problems, you may wish to share them with us.