1

I'm working on a gmail like mail application. In that I have created sign up sign in and creating mails and displaying the inbox with received mails. To display inbox I folloed the following procedure. First I created a database called getdata and stored the mails of all users in that database. When ever a user logs into his account I used the following code to display his mails from the whole database

public static DataSet Get_Data_id(string mailid, int Sno)
{
    DataSet ds = new DataSet();
    SqlCommand cmd = new SqlCommand();
    cmd.CommandText = "select * from AddData where Sno='" + Sno + "' and EmailID='" + mailid + "'";
    ds = SQLHelper.ExecuteAdapter(cmd, CommandType.Text, cmd.CommandText);
    return ds;
} 

I have given every user a serial number. Using serial number and his mail id I filled his/her inbox. Now the thing is I need to move those messages into separate folder I have a check box for every mail in inbox and by clicking on that a drop down window appears just like in gmail. But I'm getting a doubt like do I need to move all mails into separate database..? In that case I need a plenty of databases like one database for one folder. And there is also another problem like every user will have different folder names. How to overcome it. How should I design the db and how to move the mails into separate folders for each user ?

Tolga Evcimen
  • 7,112
  • 11
  • 58
  • 91
user25260
  • 11
  • 1
  • The answer of @Erno de Weerd is the answer that you should follow here, dynamic database approach is way too beyond the limits of what you are trying to achive here. – Tolga Evcimen Aug 13 '13 at 12:05

2 Answers2

3

If you want to copy gmail, do not make folders, make tags.

Create a table that will contain tags per user (tagid, userid, tagname)

Create a table that will contain the relation between emails and tags (emailid, tagid)

This way an email can have several tags and a tag can contain multiple emails.

It is also possible to retrieve all tags by user.

Emond
  • 50,210
  • 11
  • 84
  • 115
1

you need to create db dynamically.This is called "Dynamic DB" check this post it may help:

Dynamic Database Schema

Community
  • 1
  • 1
Ahmed Alaa El-Din
  • 1,813
  • 1
  • 16
  • 19