Help On Retrieving Record from database

Posted by Vijayar under C# on 12/9/2011 | Points: 10 | Views : 940 | Status : [Member] | Replies : 2
HI
I am having a table called thoughtofday where the fields are thought_id,Created_date,Thought,Fromdate,Todate .Now i want to dispaly the thought inserted in the table for online users.The thought of day should be changed for every day .How to achieve this.Please help me in this issue.When i insert " n " number of thoughts on single day.Please solve this issue .It's very urgent

vijaya


Responses

Posted by: Ksuresh on: 12/9/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Vijayar,

Go through this below link it may helps you

http://www.dotnetfunda.com/articles/article1513-how-to-retrieve-data-from-the-database-in-aspnet.aspx

thanks

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Varung on: 12/9/2011 [Member] Starter | Points: 25

Up
0
Down
MySqlCommand cmd = new MySqlCommand("select Thought from thoughtofday ", con);
MySqlDataAdapter dap = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
dap.Fill(ds);
Random r=new Random();
int randomnumber= r.Next(0, ds.Tables[0].Rows.Count);
string thought= ds.Tables[0].Rows[re]["Thought "].ToString();
con.Close();

G.Varun

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response