Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi may i ask how to Get value from database display in textbox?I had a table name mttuser.When i login it will automatic show me the personal informaion.
here is my code
C#
private void Process_Load(object sender, EventArgs e)
        {
            gent_login frm_login = new gent_login();

            using (Mttuser_DAL dalObj = new Mttuser_DAL())
            {
                if (frm_login.txt_proximity.Text != null)
                {
                    try
                    {
                        Mttuser row = new Mttuser();
                        row.us_UserID = txt_id.Text;
                        row.us_EmpName = txt_name.Text;
                        dalObj.GetRecords().Cast<Mttuser>().ToList();
                    }

                    catch (Exception es)
                    {
                        MessageBox.Show(es.Message);
                    }
                }
            }
        }
I had try it but it still no display any information that store in database.It is not using mysql or sql query because it had the connect code behind the code.
Posted

1 solution

Do the following -
1) Take the query and run it on the backend. It may not be returning any results.
2) Debug the code you posted here to check whether has some data in it (especially the object dalObj (dalObj.GetRecords().Cast<mttuser>().ToList();</mttuser>).
3) There is no code here that sets this object to a textbox for e.g. you will need some code like myTxtBox = dalObj.First();.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900