我没看但是根据提示这个是写XML的,好事VB的---哎。。。。QUICKSTART呀。。靠你就可以说几天了

发表于:2007-06-30来源:作者:点击数: 标签:
%@ Import Namespace=System.Data % %@ Import Namespace=System.Data.SqlClient % html head script language= VB runat=server Public Source As DataView Public DS As DataSet Public GetSchemaChecked, GetDataChecked As Boolean Sub Submit_Click(Send
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<html>
<head>

    <script language="VB" runat="server">

        Public Source As DataView
        Public DS As DataSet
        Public GetSchemaChecked, GetDataChecked As Boolean

        Sub Submit_Click(Sender As Object, E As EventArgs)

            If (Page.IsPostBack)

                Dim MyConnection As SqlConnection
                Dim MyCommand As SqlDataAdapter

                MyConnection = New SqlConnection(ConnectString.Value)
                MyCommand = New SqlDataAdapter(MyText.Value, MyConnection)

                DS = New DataSet()
                MyCommand.Fill(DS, "Table")

                Source = New DataView(DS.Tables(0))

                GetSchemaChecked = GetSchema.Checked
                GetDataChecked = GetData.Checked

                MyDataGrid.DataSource=Source
                MyDataGrid.DataBind()
            End If
         End Sub

    </script>

</head>
<body bgcolor="ffffclearcase/" target="_blank" >cc">

    <h3><font face="Verdana">SQL to XML Generator</font></h3>

    <form runat="server">

        <table border=0 cellpadding=5 style="font:10pt verdana">
        <tr>
          <td colspan="2">
            <b>Connect String:</b><br>
            <input id="ConnectString" type="text" value="server=(local)\NetSDK;database=pubs;Trusted_Connection=yes" size="85" runat="server">
          </td>
        </tr>
        <tr>
          <td colspan="2">
            <b>Query:</b><br>
            <input id="myText" type="text" value="select * from Authors" size="85" runat="server">
          </td>
        </tr>
        <tr>
          <td>
            <input type="radio" id="GetSchema" name="Mode" runat="server"/>Get XML Schema<br>
            <input type="radio" id="GetData" name="Mode" runat="server"/>Get XML Data<br>
            <input type="radio" id="GetBoth" name="Mode" checked runat="server"/>Get Both
          </td>
          <td valign="top">
            <input type="submit" runat="server" OnServerClick="Submit_Click">
          </td>
        </tr>
        <tr>
          <td colspan="2">

              <%  If Page.IsPostBack  %>
                  <b>Result:</b><br>
                  <textarea cols=80 rows=25>
              <%
                  If GetSchemaChecked
                      DS.WriteXmlSchema(Response.Output)
                  Else If GetDataChecked
                      DS.WriteXml(Response.Output, XmlWriteMode.IgnoreSchema)
                  Else
                      DS.WriteXml(Response.Output)
                  End If
              %>
                  </textarea>
              <%  End If  %>

          </td>
        </tr>
        <tr>
          <td colspan="2">

              <%  If (Page.IsPostBack)  %>
                  <b>Data:</b><br>
              <%  End If  %>

              <ASP:DataGrid id="MyDataGrid"
                BackColor="#EDBE7B"
                BorderColor="black"
                ShowFooter="false"
                CellPadding=3
                CellSpacing="0"
                Font-Name="Verdana"
                Font-Size="8pt"
                HeaderStyle-BackColor="#DC6035"
                EnableViewState="false"
                runat="server"
              />

          </td>
        <tr>
        </table>

    </form>

</body>
</html>


  

原文转自:http://www.ltesting.net