将“System.Data.SqlClient.SqlCommand”隐式转换为“System.Data.SqlClient.SqlConnection"

问题:
1.无法将类型“System.Data.SqlClient.SqlCommand”隐式转换为“System.Data.SqlClient.SqlConnection”
2.“SqlConnection”未包含“ExecuteNonQuery”的定义,并且找不到可接受第一个“SqlConnection”类型参数的可访问扩展方法“ExecuteNonQuery”(是否缺少 using 指令或程序集引用?)
3.“SqlConnection”未包含“ExecuteReader”的定义,并且找不到可接受第一个“SqlConnection”类型参数的可访问扩展方法“ExecuteReader”(是否缺少 using 指令或程序集引用?)
代码:

结语:急需,感谢感谢!

你能把SqlCommand对象和SqlConnection对象搞混了,我都不用看其他的错误信息了,你还是放代码吧,保证是写的乱七八糟
简单来说,SqlConnection对象只有Open和Close方法
SqlCommand对象才有ExecuteNonQuery方法

https://learn.microsoft.com/zh-cn/dotnet/api/system.data.sqlclient.sqlcommand?redirectedfrom=MSDN&view=dotnet-plat-ext-7.0
https://learn.microsoft.com/zh-cn/dotnet/api/system.data.sqlclient.sqlconnection?view=dotnet-plat-ext-7.0


这是少了命名 空间吧 
using System.Data;
System.Data.SqlClient;