Web-based configurable DB using Microsoft products - asp.net

I'm looking for a method or a platform that I can build on that would allow for the configuration of a dynamic DB from web-based configuration pages rather than having to hard code the DB tables in the back end. I offer an example:
I have an asp.net app with a DB. In that DB I want to put a table that tracks the following attributes:
Field1 = 80 char field
Field2 = date field
Field3 = Text area
Currently I have to manually create a new table directly in my SQL DB with 4 columns: Autonumber ID field, Char field, Date Field, Long Text field.
I would like to have a backend web page in my asp.net app where I could do the following through .Net web pages alone without having to touch the DB directly:
Create a table called TABLE1 with the Char field, the Date field, and the Text field (the ID field would be created automatically)
Add fields to this table at any time through the back end .Net web pages.
Add relationships between fields/tables.
I'd prefer to use a Microsoft product/functionality to allow for this dynamic DB creation and administration as it would allow me to give more power to my users and mean that I wouldn't have to hard code everything directly in the DB. I know this is possible because I can see it being used by large companies like Salesforce.com. Any direction on books, products/platforms or techniques on how this can be accomplished on a smaller scale?

Related

Make form-style information display on a webpage

I have a website (bootleg/css) I put together. I am currently implementing user registration but I am having troubles determining the best way to go about the following:
I have users that will be entering their teammates, and themselves into a tournament (via a form). That's the easy part. Once the users have input their info, I'd like the webpage to populate with the registered team in a designated area. The structure as so:
(Registration form)
TEAM NAME
Member 1
Member 2
Member 3
Member 4
I want it to take TEAM NAME and display it in a specific section of a webpage for those registered. Like so:
(Displayed as so)
REGISTERED TEAMS:
Slayers
Dominatrix
Evolution
I am most familiar with css and html, but I am willing to work with php as long as it can be injected into the current site. I have a MySQL server setup and can edit it further. I've done a LOT on the design side, but not too much on the scripting side until recently so go easy on me.
You can do this by simply using PHP and MySQL.As you said,you are familiar with MySQL,I would give you the outline to do this.
Make a table for the registered users,Insert data to MySQL Database using INSERT Query in MySQL.
INSERT INTO Table_name (id,member_name,member_age,...) VALUE ('','$name','$age',...)
You can select all the values using SELECT Query from Database Table,and echo it on HTML part,where you want to show the result.
SELECT * FROM Table_name

Single website multiple databases, database switching

I have created a content management system (CMS) for my company’s product databases. The CMS is based on asp.net scaffolding with many custom pages and actions mixed in. We have 7 products currently, all of which share the same database schema (Entity Framework model-first) and all run perfectly in the CMS. The issue is that every time we get a new product we must clone the CMS and change the connection string in the app.config to point to the correct database in order to work with the new database. While this works, it’s becoming bothersome to maintain and will fail us completely as we acquire more products.
What I would like to do is have a centralized landing page where a user is directed to log in, then given the option to connect to and edit a specific product based on their selection. The idea is that we would have one CMS site which would be able to switch between the databases depending on the user. It is not an option to combine all of the product database in to a single master product database.
I am not sure where to start to achieve this goal, or if this is even the correct plan to achieve my goal of having a single CMS to maintain, and am looking for some guidance in this.
Assuming that your database structures are identical, you could use a factory method anywhere you get an instance of your entity context and put logic in there to grab the correct connection string (or calculate it if there's a naming convention that you could use). Something like this might work for example:
public static MyDatabaseEntities CreateEntityContext(string productName)
{
string connectionString = null;
switch (productName.Trim().ToLower())
{
case "apples":
connectionString = ConfigurationManager.ConnectionStrings["MyDatabase_Apples"].ConnectionString;
break;
case "pears":
connectionString = ConfigurationManager.ConnectionStrings["MyDatabase_Pears"].ConnectionString;
break;
default:
connectionString = ConfigurationManager.ConnectionStrings["MyDatabase"].ConnectionString;
break;
}
return new MyDatabaseEntities(connectionString);
}
Then use this method anywhere you need an instance of your CRM data context passing in the product name that you've calculated on your landing page.
Create another database for user to database mapping. The structure would be like so:
database UserMap
table Users
username (composite primary key)
dbID (composite primary key, foreign key to "Databases" table)
table Databases
dbID (primary key)
connectionString
Then,
populate the list of database in table "Databases"
Do your SQL work to copy the users from the other websites into this "UserMap" database
Write a trigger in each CMS database to add or remove a user as they are created or removed in their respective CMS so it updates the "UserMap" database
Modify your code on the CMS(s) to use this single database for lookup to what connection string should be used.
This would allow you to rely on the single database for the lookup and switch between them in a managed fashion going forward. It requires some up front work but after the triggers are there, you don't have to do anything more.

spreadsheet like asp.net and dynamic view

I want to create an application that users can select fields from database table and create a spreadsheet by those data. Is any control or sample to implement it?
Getting the schema of table varies from database to database.
No matter which database you use, it would be easy to get the list of columns and let the user select which columns to show.
To create a speardsheet you should look at these controls ASP.NET Real World Controls
These custom controls enable you to create excel like grids in asp.net. It is open source allowing you to extend them as may be needed by your project.

How to create Dynamic table in ms sql?

I have a Membership form in asp.net Which contains custom fields.so by that custom Field User can generate more than one field dynamically
for Example (User can add Mobile number column in their membership form (they can add what ever they need)).So i cant able to maintain static table for Membership control in ms sql.
Is there any way to create dynamic table in ms sql for Dynamic Membership form.(whenever user adding column dynamcally i should get those column in ms sql dynamic table)
please help me to solve my problem

Adding an integer ID to ASP.NET Forms Authentication

In the standard forms authentication, users are identified by a Guid. I want to give my users an UserId of type int (doesn't have to be the primary key, just something to do lookup's on).
Is it safe to add an additional column to the aspnet_users table, or should I create a new table which FKs to the UserId column and has a Unique column which generates the integer ID?
The later sounds like a bad performance hit to take just for the sake of an int!
EDIT
I want to create URLs like those on stackoverflow. eg. https://stackoverflow.com/users/23590/greg-b where the User ID is an int. For that reason I don't want to use Guids.
I'd create profiles and store the associated urlID there. Web Forms don't have Profiles available out of the box, but you can see a workaround here:
http://www.codersbarn.com/post/2008/06/01/ASPNET-Web-Site-versus-Web-Application-Project.aspx
The advantage of using Profiles is that you can tap into all the existing logic and won't have to write as much custom code yourself, aside from constructing the URL.
You could combine this with Routing for friendly URLs, if you're using ASP.NET 3.5 or up.
UPDATE: kinda similar question:
Shorter GUID using CRC

Resources