• 全部
  • 问答

ASP.NET真的挺烦人的!有谁有ASP.NET关于数据库操作的例子(VB)的!

happynet 2002-03-01 11:30:48
学这玩艺真是费神又费力!系统搞的乱七八糟!累!

各位大侠,谁有例子呀?给个看看!送分啦!
...全文
5 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
icyer 2002-03-02
http://www.gotdotnet.com/quickstart/aspplus/doc/webdataaccess.aspx
里面有很多例子。
回复
zhangxiaogen 2002-03-01
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<html>
<head>
<link rel="stylesheet"href="intro.css">
</head>

<script language="VB" runat=server>

Sub SubmitBtn_Click(Sender As Object, E As EventArgs)

Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New SqlConnection("server=(local)\NetSDK;database=pubs;Trusted_Connection=yes")
'MyConnection = New SqlConnection("server=(local);database=pubs;Trusted_Connection=yes")
MyCommand = New SqlDataAdapter("select * from Titles where type='" + Category.SelectedItem.Value + "'", myConnection)

DS = new DataSet()
MyCommand.Fill(DS, "Titles")

MyList.DataSource = DS.Tables("Titles").DefaultView
MyList.DataBind()

End Sub


</script>

<body>

<center>

<form action="intro8.aspx" method="post" runat="server">

<asp:adrotator AdvertisementFile="ads.xml" BorderColor="black" BorderWidth=1 runat="server"/>

<h3> Name: <asp:textbox id="Name" runat="server"/>

Category: <asp:dropdownlist id="Category" runat=server>
<asp:listitem >psychology</asp:listitem>
<asp:listitem >business</asp:listitem>
<asp:listitem >popular_comp</asp:listitem>
</asp:dropdownlist>
</h3>

<asp:button text="Lookup" OnClick="SubmitBtn_Click" runat="server"/>

<p>

<ASP:DataGrid id="MyList" HeaderStyle-BackColor="#aaaadd" BackColor="#ccccff" runat="server"/>

</form>

</center>

</body>

</html>

回复
发帖
.NET技术其他语言
创建于2007-09-28

1814

社区成员

.NET技术 其他语言讨论
申请成为版主
帖子事件
创建了帖子
2002-03-01 11:30
社区公告
暂无公告