Project still alive?

Sep 22, 2011 at 6:33 PM

Is this project still alive?

Looking at your code, there is a lot that can be changed to make it easier to maintain and read, and increase the efficiency of it.

Sep 23, 2011 at 8:52 AM

Yes its still alive.
Tell me what changes would you make to make this more efficient ? 

Sep 29, 2011 at 6:26 PM

Have you ever thought about LINQ2SQL? You're using ASP.NET and SQLServer. This way you can completely get rid of the actual SQL commands within your code anyway.

You also don't seem have a designated data layer to your code. I.e your SQL code to return topics is within the page itself. This shouldn't really be the case, there should be a layered structure to it, otherwise you'll quickly find things get messy. You can see this already because you've got datatables and dataset's all over the place.

You are also opening connections all over the place. Why not implement a base connection in your master page. All your pages inherit from it after all, open the connection in the master page, and that's that, one place?

On the subject on connections, even when you are opening the connections everywhere you are actually specificing your connection string every time. Why not implement a base class, keep the connection string in that one place, as a property and call it whenever you open a SQL connection? One place that way. As it stands, if you move your database or change it's details you will have to change the connection string in a LOT of places.

For example instead of:

con = new SqlConnection("server=ABHISHEK-PC; database=ForumProj; Integrated Security=True;");
        da = new SqlDataAdapter("Select ImgPath FROM UserRegInfo where UserId= "+id, con);

You could make it:

conn = new SqlConnection(ConnectionString);
Where ConnectionString is a property implemented in a base class somewhere. Makes it more readable, no?