473,387 Members | 1,628 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

populate record from db into web form textfield

Hi
I am trying query the data from db and populate in the web form's
textbox field. so far I cannot put that
record into the text field box. anyone has idea on that, below is my
sample code
thanks in advance

<%'@ Page Language="VB" AutoEventWireup="false"
CodeFile="modifyuser.aspx.vb" Inherits="modifyuser" %>
<script runat="server">
Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)
Dim myConn As New
Data.OleDb.OleDbConnection("Provider=SQLOLEDB.1;Pa ssword=xxxxxxx;Persist
Security Info=True;User ID=xx;Initial Catalog=testdata;Data
Source=pub")
Dim strSQL As String = "Select * FROM test where name =
'peter'"
Dim myCommand As New Data.OleDb.OleDbDataAdapter(strSQL,
myConn)

Dim ds As Data.DataSet = New Data.DataSet()
myCommand.Fill(ds, "test")

MyDataList.DataSource = ds.Tables("test").DefaultView
MyDataList.DataBind()
End Sub
</script>

<html>
<body>
<ASP:DataList id="MyDataList" RepeatColumns="1"
RepeatDirection="Vertical" runat="server">
<ItemTemplate>
<form id="form1" runat="server">
<asp:TextBox ID="lastname" runat="server" MaxLength="50"
text="<%#DataBinder.Eval(Container.DataItem, "word")%"></asp:TextBox>

</form>

</ItemTemplate>
</ASP:DataList>
</body></html>

Jan 3 '07 #1
2 1988
weiwei wrote:
Hi
I am trying query the data from db and populate in the web form's
textbox field. so far I cannot put that
record into the text field box. anyone has idea on that, below is my
sample code
thanks in advance

<%'@ Page Language="VB" AutoEventWireup="false"
CodeFile="modifyuser.aspx.vb" Inherits="modifyuser" %>
---------canned
reply-------------------------------------------------------------
There was no way for you to know it (except maybe by browsing through
some of the previous questions before posting yours - always a
recommended practice), but this is a classic asp newsgroup. ASP.Net is
a different technology from classic ASP. While you may be lucky enough
to find a dotnet-savvy person here who can answer your question, you
can eliminate the luck factor by posting your question to a newsgroup
where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
There are also forums at www.asp.net where you can find a lot of people
to help you.
------------------------------------------------------------------------
-----------------

You might want to clarify the symptoms you are experiencing when you
post there. What happens when you run this page?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jan 3 '07 #2
On Jan 3, 1:46 pm, "weiwei" <weihuang...@gmail.comwrote:
<body>
<ASP:DataList id="MyDataList" RepeatColumns="1"
RepeatDirection="Vertical" runat="server">
<ItemTemplate>
<form id="form1" runat="server">
<asp:TextBox ID="lastname" runat="server" MaxLength="50"
text="<%#DataBinder.Eval(Container.DataItem, "word")%"></asp:TextBox>

</form>

</ItemTemplate>
</ASP:DataList>
</body></html>
You cannot have more than 1 form element on an ASP.NET page. According
to the above code you're generating a form element for each row in your
dataset.

Cheers
Chad

Jan 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: EricRobineau | last post by:
hello I have a DB with many inter-related tables (MySQL) My main table called "content" has almost only foreign keys (integers) some have a 3 level relation (ex: content->city->region->country) ...
4
by: Frank Py | last post by:
I have 4 possible values that I would like to populate a text box with depending on which 4 values are sleected in a select box. Is there an example out there for this? Thanks Frank ***...
2
by: Oliver Gabriel | last post by:
hello, i have a form with a table on its back. The primary key is an autonumber field called "ID". I have a textfield displaying the value of this field (just for my info, data is sure entered...
4
by: Mike L | last post by:
I'm open for any suggestions on how to better program this. I want the user to select a license from a combo box, cboPrivilege and then the user will click the add button, then a record will be...
6
by: Sanjay | last post by:
Hi, Is it possible to save all the names/values of a form to another memo textfield before a Insert to the database then when required on another page split that memo textfield into the name and...
0
by: weiwei | last post by:
Hi I am trying query the data from db and populate in the web form's textbox field. so far I cannot put that record into the text field box. anyone has idea on that, below is my sample code...
5
by: vidyagopal | last post by:
I have a jsp page these are three formfields itemsr : --it is a combobox itemtype : --textfield itemname : --textfield to itemsr i have to populate from itemtable(database mysql) and...
1
by: macintoshhondo | last post by:
Hi ! i am a newbie and dont know javascript much. what i really need is a simple javascript code that can insert number in the value section of the different forms from the one form. FORM 1:...
2
by: sukatoa | last post by:
I am a newbie on JavaScript.... I would like to know about what's wrong in my code below: <html> <head> <title>Text Example</title> </head> <body>
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.