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
[color=blue]
>-----Original Message-----
>Paschalis Pagonidis <anonymous@discussions.microsoft.com>[/color]
wrote:[color=blue][color=green]
>> I have a class which all its attributes, properties and
>> methods are static.
>>
>> However, I want a method to return an object that[/color][/color]
should[color=blue][color=green]
>> be non-static.
>>
>> Is that possible?[/color]
>
>Objects themselves aren't static or non-static - the[/color]
concept just[color=blue]
>doesn't apply. Could you give more details about what[/color]
you're trying to[color=blue]
>do?
>
>--
>Jon Skeet - <skeet@pobox.com>
>
http://www.pobox.com/~skeet
>If replying to the group, please do not mail me too
>.
>[/color]