I have a class like this:
class connect:IDisposable { public void OpenChannel(SqlConnection ch) { ch.ConnectionString="....."; ch.Open(); } public void Dispose() { } } And another class like this:
public Cust { SqlConnection channel=new SqlConnection(); SqlCommand command=new SqlCommand(); public void Method() { using(connect con=new connect()) { con.OpenChannel(channel); command.connection=channel; ..... .... .... command.ExecuteNonQuery(); } } But when I run ExcuteNotQuery() there is an error: "no open connection" So what is wrong?
connectshould start with a capital C.Custis a customer - not sure that a customer style entity usually has it's own connection/command fields. Unrelated to the issue - I'm just saying...