标题:[求助]大家请协助解答一下.NET的数据连接问题-->bygg转移
只看楼主
lookzf2007
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-4-12
 问题点数:0 回复次数:1 
[求助]大家请协助解答一下.NET的数据连接问题-->bygg转移

我的程序语言是用VB,我这段代码写好后,运行起来没有提示错误,可是我的DATAGRID控件却没有任何内容
请高手帮我看看


================================================
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="second.aspx.vb" Inherits="second" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>试验</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
}
-->
</style>
<script language="vb" runat="server">
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Sub page_load(ByVal Sender As Object, ByVal E As EventArgs)
If (Page.IsValid) Then
MyConnection = New SqlConnection("server=(local); database=pubs; uid=sa; pwd=sa; Trusted_Connection=yes")
MyCommand = New SqlDataAdapter("select * from titlesl where where price <> 0", MyConnection)
DS = New DataSet()
MyCommand.Fill(DS, "Titles")
dategrid1.DataSource = DS.Tables("Titles").DefaultView
dategrid1.DataBind()

End If
MyConnection.Close()
End Sub

</script>
</head>
<body>
<form id="form1" runat="server">
<asp:DataGrid ID="dategrid1" runat="server"></asp:DataGrid>
</form>
</body>
</html>

=============================================


谢谢了,请指教

搜索更多相关主题的帖子: bygg NET 数据 协助 解答 
2007-04-13 11:50
liuminghui
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:2882
专家分:0
注 册:2007-1-26
得分:0 

海鸽 is My Lover!!
2007-04-13 12:10



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




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

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