如何使用DAL和BLL从Databse向文本框写入值 [英] How to write value to a textbox from databse using DAL and BLL

查看:98
本文介绍了如何使用DAL和BLL从Databse向文本框写入值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想检查用户是否存在,如果存在,则应将用户密码检索到textbox2,我正在使用BLL检查用户是否存在.

Hi,
I want to check whether user exists, if exists then user password should be retrieved to textbox2, I am using BLL to check whether user exists or not.

Protected Sub button1_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim productslogic As New productsBLL()
        Dim anil As DataSet1.asaaDataTable = productslogic.GetDataByname(TextBox1.Text)
TextBox2.Attributes.Add("value", productslogic.GetDataByname(TextBox1.Text))



使用此代码时,出现以下错误:错误:无法将类型"DataSet1.asaaDataTable"的值转换为字符串".如果将其转换为字符串,则表示使用此代码:



When using this code, I am getting following error: ERROR:Value of type ''DataSet1.asaaDataTable'' cannot be converted to ''String''. If I am converting this to string then I am using this code:

Protected

Sub button1_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim productslogic As New productsBLL()

Dim anil As DataSet1.asaaDataTable = productslogic.GetDataByname(TextBox1.Text)

 TextBox2.Attributes.Add("value", productslogic.GetDataByname(TextBox1.Text).ToString)



这可以正常执行,但是在textbox2中,我得到了数据表名称:asaa(asaa是我的数据表),但是我希望用户密码进入文本框.在我的BLL产品中,logic.GetDataByname(TextBox1.Text)的代码是:



This is executing properly but in textbox2 I am getting the data table name: asaa (asaa is my datatable) but I want the user password into the textbox. In my BLL productslogic.GetDataByname(TextBox1.Text) the code I am using is:

select password from asaa where name=@name



您有什么帮助吗?谢谢!



Any help from your side? Thank you!

推荐答案

编写此代码的原因是错误的.如果您自行设置密码,则拥有登录密码有什么意义(以某种方式!)..

如果要执行类似的操作,而不是删除登录名/密码,因为这是保护网站和个人首选项的步骤-为他们提供隐私和安全性.

设计或思考您打算做什么的另一种方式.
The very reason to code this thing is wrong. Whats the point of having a login-password if you set the passowrd yourself (somehow!)..

If you want to do something like that than remove login/password as they are steps of securing a site and individual preferences - giving them privacy and security.

Design or think another way to what you are planning to do.


停止询问相同的问题.之前已被告知您不要执行此操作,并且您无法设置密码文本框的文本.关于此主题的任何其他问题都将被删除.
Stop asking the same question. You have been told before not to do this and you cannot set the text of password textbox. Any further questions on this subject will be removed.


这篇关于如何使用DAL和BLL从Databse向文本框写入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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