Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scoping of class property
Message
From
21/12/2005 09:56:34
 
 
To
20/12/2005 10:24:22
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01079106
Message ID:
01079860
Views:
43
I woke up in the middle of the night, had a hard time getting back to sleep, so my mind started wandering. It ended up on this topic for some strange reason ... I wondered why you are passing the connection string to your SQLExec method. Your Framework.Data class should simply get the connection string itself from your ConfigurationSettings.AppSettings["ConnectionString"]. It's really something that should be encapsulated within a DataAccess class, IMHO.

~~Bonnie



>>Anyway, I guess I didn't even notice that you were passing the connection around. Your problem however was mainly the overuse of Shared members ... not a good idea for anything web-related that is supposed to be stateless. It looks like you've got it solved now though, and that is good.
>
>Yes, Shared members but mainly the connection issue.
>
>>I have a comment on your code, however. Since you're using the DataAdapter.Fill() method, you don't need to Open and Close your connection. The .Fill method takes care of it automatically ... if the Connection is already open, it's left open, if it's closed, the Fill will open it, fill the DataSet and then close it.
>
>Thanks, I will adjust that code.
>
>>For other methods, like a SqlCommand.ExecuteNonQuery(), you *do* need to Open and Close the connection. Plus, the connection should only be open for as brief a time as possible, so be careful where you put your Open and Close.
>
>Very well
>
>>As far as speed goes, it should be fine. With SQL Connection pooling, the connections are re-used and it's very fast. However, I notice that you're using OleDbConnection rather than SqlConnection, so you're probably not using SQL Server. I'm not sure how this affects the speed of VFP.
>
>Is there a way to have that code generic, by the use of SqlConnection, even if I have VFP for the backend?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform