I have a Database class that manages all database related
functionality.
For example instead of initializing SqlDataReader
variables each time in my whole project, I use commands
such as the following:
SqlDataReader data = Database.Execute
("MyStoredProc", "MyParams");
Database class has a static Connection variable which is
used in all forms. Furthermore all Database
constructors/properties/attributes/methods are static.
My problem is that the Execute command returns a static
SqlDataReader object, so I cannot re-execute a sql connand
inside a data.Read() loop:
while (data.Read())
{
data2 = Database.Execute(...); // <-- runtime error
occurs because data is already open.
}
data.Close();
// now that I closed data I can execute again...
thanks,
Pascal
-----Original Message-----
Paschalis Pagonidis <an*******@discussions.microsoft.com>
wrote: I have a class which all its attributes, properties and
methods are static.
However, I want a method to return an object that
should be non-static.
Is that possible?
Objects themselves aren't static or non-static - the
concept justdoesn't apply. Could you give more details about what
you're trying todo?
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.