Visual studio and SQL
ı am taking System.InvalidOperationException: 'ExecuteNonQuery: Connection property has not been initialized.' eror can you help me 😦
6 Replies
You need to pass your SqlConnection object in the constructor of SqlCommand
How can ı do 😦
using var cmd = new SqlCommand(sql, conn);
Alternately you can set the Connection property of the SqlCommand instance
But probably easier to just pass it in the constructor.thank u ı will try ıt
❤️ ❤️
sory for my newbie. I tryd but I couldn't do what you said 😦
Why not?
ı solve it
but
thank you a lot of 🥺