标题:如何将移动控件List更sql server2000里的数据绑定
只看楼主
wjyter
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-3-19
结帖率:0
已结贴  问题点数:20 回复次数:1 
如何将移动控件List更sql server2000里的数据绑定
最近小弟在使用做些wap网站方面的东西,但一直弄不懂怎么才能将list跟数据库里面的数据绑定。下面是小弟做的,但还不完整或者是错误的。求安慰大虾救救小弟
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<script>
   Dim objectConnection As New SqlConnection("Server=localhost;Database=timetable;user id=root;password=root")
   Dim objDataAdapter As New SqlDataAdapter()
   Dim objDataSet As New DataSet()
   objDataAdapter.SelectCommand = New SqlCommand()
   objDataAdapter.SelectCommand.Connection = objectConnection
   objDataAdapter. = "SELECT * FROM t_admin"
   objDataAdapter. = CommandType.Text
   objectConnection.Open()
   objDataAdapter.Fill(objDataSet, "admin")
   Dim customersTable As DataTable = _
   objDataSet.Tables.Add("CustomersTable")
   DataGrid1.DataSource = new DataView(customersTable)
   DataGrid1.DataBind
   objectConnection.Close()
   objDataAdapter = Nothing
   objectConnection = Nothing
   
</script>
<html xmlns="http://www. >
<body>
    <mobile:Form id="Form1" runat="server">
        <mobile:List ID="dataGrid1" Runat="server" >
        </mobile:List>

    </mobile:Form>
</body>
</html>
搜索更多相关主题的帖子: 绑定 List sql server 控件 
2010-04-22 13:54
czyzhuo
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:17
帖 子:230
专家分:1459
注 册:2010-3-11
得分:20 
数据绑定方面的,你调试一下看看是否正确不就行了吗?
2010-04-27 15:06



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-304018-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.585535 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved