<pre lang="xml"><%@ Page Language=VB Debug=true %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OLEDB" %> <script runat=server Language=VB > 'Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs) Dim intBtnClkCount As Integer = 0 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles writeButton.Click intBtnClkCount += 1 ' writeButton.Visible = False End Sub Sub objWriter(ByVal s As Object, ByVal e As EventArgs) Dim FILE_NAME As String = "C:\Users\Fe\Desktop\xml\test.f" Dim DBConn As OleDbConnection Dim DBCommand As OleDbDataAdapter Dim DSPageData As New DataSet Dim I As Long DBConn = New OleDbConnection( _ "PROVIDER=Microsoft.Jet.OLEDB.4.0;" _ & "DATA SOURCE=" _ & Server.MapPath("storage1.mdb;")) DBCommand = New OleDbDataAdapter _ ("Select * from samplesource", DBConn) DBCommand.Fill(DSPageData, _ "samplesource") For I = 0 To DSPageData.Tables("samplesource").Rows.Count - 1 Dim objWriter As New System.IO.StreamWriter(FILE_NAME) lblMessage.Text = lblMessage.Text _ & "<BR>Processed Record: " _ & DSPageData.Tables("samplesource"). _ Rows(I).Item("s1") objWriter.Close() Next End Sub </SCRIPT> <HTML> <HEAD> <TITLE></TITLE> </HEAD> <Body LEFTMARGIN="40"> <form id="Form1" runat="server"> <BR><BR> <asp:label id="lblMessage" runat="Server"/><asp:Button ID="writeButton" Text="Write" runat="server" OnClick="objWriter" /> </form> </BODY> </HTML>
StreamWriter
Write()
WriteLine()
lblMessage.Text
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)