如何从数据库表中填充文本框 [英] how to fill textbox from database table

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

问题描述

我有两张桌子:1)个人资料 - >字段是:

prof_id

名称

地址

city_id

mob_no

emailid

log_id



2)登录--->字段是:

log_id

用户名

密码



和我的个人资料页面包含

名称:文本框

地址:文本框

city:dropdownlist

mob。 NO:textbo x

emailid:文本框

用户名:文本框

密码:文本框





现在,我必须将此表中的数据填充到所有这个文本框中。

用户名,密码来自登录表,剩余数据来自配置文件表。 />
我知道如何从单个表填充数据,但我不知道如何从多个表填充文本框这个问题。请帮助我。

解决方案

掌握ASP.NET数据绑定 [ ^ ]


< blockquote>

  string  sql =  选择名称,
地址,
city_id,
mob_no,
emailid,用户名
来自个人资料f的密码,登录l其中f.log_id = l.log_id

< span class =code-comment> // 在数据集中填写结果的代码

TextName.Text = ds。表[ 0 ]。行[ 0 ] [ name]。ToString();
// 像上面一样写


感谢


i have two table:1)profile-->fields are:
prof_id
name
address
city_id
mob_no
emailid
log_id

2)login--->fields are:
log_id
username
password

and my page for profile contain
name: textbox
address:textbox
city:dropdownlist
mob.no:textbox
emailid:textbox
username:textbox
password:textbox


now ,I have to fill data from both this table to all this textbox.
username,password are taken from login table and remaining data come from profile table.
I know how to fill data from single table ,but i don''t know for this problem that how to fill textbox from more then one table.please help me.

解决方案

Mastering ASP.NET DataBinding[^]


string sql="select name,
 address,
 city_id,
 mob_no,
 emailid,username
 password from profile f,login l where f.log_id=l.log_id"
//write code for fill result in dataset 

TextName.Text=ds.Tables[0].Rows[0]["name"].ToString();
//write same like above


Thanks


这篇关于如何从数据库表中填充文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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