Article: ExecuteNonQuery: Insert Update and Delete examples in C# and VB.Net
Hello, I'm in the process of converting VBA to VB.NET with SQL statements. One of the changes is utilizing th"e "ExecuteNonQuery. Sincee I'm still learning the syntax, I simply copied the VB.NEt statements above for the "UPDATE Persons SET CITY . . . ". But I'm getting 2 errors: #1. error "BC3002 Type 'SqlConnection' is not defined" and #2. error BC3002 Type 'SQLCommand' is not defined" when compiling using Visual Studio. And I included the 2 IMPORTS as well, but still these 2 compiler errors. What am I doing wrong? Thanks
Hi jyakomorossi,
What namespaces (IMPORTS) are you inheriting?
For SqlConnection and SqlCommand you need to import the following namespace.
C#
using System.Data.SqlClient;
VB.Net
Imports System.Data.SqlClient
© COPYRIGHT 2024 ASPSnippets.com ALL RIGHTS RESERVED.