Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi there

in vb.net when i make mistakes in query then it's not giving error.

so how can i know what is the mistake in my query.
Posted
Comments
Savalia Manoj M 26-Sep-12 23:16pm    
Have you Add Try Catch Block? If Not then add and check.

1 solution

The simple answer here is that an error isn't being thrown or you are ignoring it. Don't forget that VB.NET isn't validating your SQL code (for the most part). Instead, SQL Server is doing that. Therefore, you won't get the same error events as you would in your code. Depending on how you are connecting to your SQL server, you can usually query the command object (I believe that is the one) to get error information.

Don't forget too that a SQL statement that returns the wrong information isn't an error. Otherwise it might be working and just not doing what you want it to do.

My suggestion is to run all queries in SQL and then copy them into VB.NET. Also, use Stored Procedures so you can make simple calls to the server.
 
Share this answer
 
Comments
[no name] 27-Sep-12 3:58am    
Good explanation.
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900