Reputation: 11
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 ?
Upvotes: 1
Views: 132
Reputation: 50682
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.
Upvotes: 3
Reputation: 1833
you need to create db dynamically.This is called "Dynamic DB" check this post it may help:
Upvotes: 1