I got a WCF service which connects to DB and gets|sets some data via a WCF client. I only do this "SqlConnection sqlConn = new SqlConnection(..." once in the constructor of my class and then I do several SqlCommand MyCommand = sqlConn.CreateCommand(); sometimes at the same time.
Now my question is : Bare in mind several queries are run at the same time by one and|or more client(s), as in if I have a "void listmystuff(string tableID);" it can be called several times from one client or sometimes from different clients but with different "tableID" variable. Do I need to do a "new SqlConnection(..." for each of my queries? I mean, Do I need to put the "new SqlConnection(..." inside my void or is it enough to put it ONCE in the constructor of my class? Also : My class gets created only ONCE as ONE object for each client but it gets used several times ( still same object ) and at the same time sometimes but different "tableID".
I hope I managed to ask this clear enough. My issue is I get a weird error sometimes that sais "Some field is not part of my table" so I was thinking perhaps since I do the "new SqlConnection(..." only once and using the same SqlConnection "everywhere", maybe they get mixed up or something?
Thank you.