从文本框中的数据库显示中获取价值 [英] Get value from database display in textbox

查看:79
本文介绍了从文本框中的数据库显示中获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我可以问如何从文本框中的数据库显示中获取价值?我有一个表名mttuser。当我登录时它将自动显示个人信息。

这里是我的代码

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

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);
                    }
                }
            }
        }

我试过但它仍然没有显示存储在数据库中的任何信息。它不使用mysql或sql查询,因为它有代码背后的连接代码。

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.

推荐答案

执行以下操作 -

1)获取查询并在后端。它可能没有返回任何结果。

2)调试你在这里发布的代码以检查其中是否有一些数据(尤其是对象 dalObj(dalObj.GetRecords())。 Cast< mttuser>()。ToList();< / mttuser> )。

3)此处没有代码将此对象设置为文本框,例如你需要一些代码,比如 myTxtBox = dalObj.First();
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();.


这篇关于从文本框中的数据库显示中获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆