Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Error 3 'System.Data.SqlClient.SqlCommand' does not contain a definition for 'close' and no extension method 'close' accepting a first argument of type 'System.Data.SqlClient.SqlCommand' could be found (are you missing a using directive or an assembly reference?)



I am failling to understand what this means
Posted
Updated 5-Apr-13 7:48am
v2
Comments
[no name] 5-Apr-13 15:23pm    
Please do not edit a question that you have an answer to, to ask a completely different question. It really throws things off.

The error message is telling you exactly what the problem is
C#
con.Close()

should be
C#
con.Close();


And use parameterized queries to prevent SQL injection attacks.
 
Share this answer
 
To answer your completely new and unrelated question, C# is a case sensitive language. Close() and close() are unrelated function calls. A SqlCommand object does not have a Close method which is what the error is telling you. You should be wrapping objects that implement IDisposable in using statements anyway.

Link to the documentation[^]
 
Share this answer
 

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



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