default.aspx.vb

来自「對c#初學者參考..為課題asp.net 2.0教材代碼」· VB 代码 · 共 26 行

VB
26
字号
Imports System.Data
Imports System.Data.SqlClient

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
           Handles Me.Load
        Dim connStr As String = "database=Northwind;Data Source=.\SQLEXPRESS; " _
               & "User id=wrox;pwd=wrox1*c"

        Using conn As New SqlConnection(connStr)
            Dim command As New SqlCommand("select * from customers", conn)
            conn.Open()
            Dim ds As New DataSet()
            ds.DataSetName = "Customers"
            ds.Load(command.ExecuteReader(), LoadOption.OverwriteChanges, "Customer")
            Response.ContentType = "text/xml"
            ds.WriteXml(Response.OutputStream)
        End Using


    End Sub

End Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?