Hi Greg,
When I do this and add it as a feature, the site crashes.
If you're going to try to do developer tasks you're going to have to learn to troubleshoot errors, that is part of the process, you must get the error details and figure out the cause and learn to fix it.
As far as querying the database and populating a grid, it depends on what tables you want to query and whether those table live in the mojoportal database or not. If you are using the same database then you could use the same connection string.
We actually have a built in tool for interactive queries that can show the query results in a gridview. If you wanted to be able to show those same results elsewhere like on a public page you could use a saved query to populate a grid similar to this article which shows how to use a saved query to populate a chart. This approach is a reasonable way to implement quick and dirty things though not a way to do professional feature development. If you use a saved query to query tables in the mojoPortal database like in these examples then you don't even have to worry about the connection string since DatabaseHelper already knows the connection string. Your code to bind the grid would look something like this as opposed to the code in the article that populates a chart:
using(IDataReader reader = DatabaseHelper.GetReader(string.Empty, q.Statement))
{
grid.DataSource = reader;
grid.DataBind();
}
If your custom code lives in a Visual Studio web project, you definitely don't want the web.config from that project to be used for anything and you don't want it to overwrite the mojoportal Web.config
Hope that helps,
Joe