W
weiwei
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;Password=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>
<ASPataList 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>
</ASPataList>
</body></html>
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;Password=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>
<ASPataList 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>
</ASPataList>
</body></html>