Writing text to a file: http://aspnet.4guysfromrolla.com/articles/072303-1.2.aspx
----- Original Message ----- From: "Nirmal Abraham" <[EMAIL PROTECTED]> To: "ASP.NET" <[email protected]> Sent: Thursday, September 22, 2005 6:13 AM Subject: [AspNetAnyQuestionIsOk] StringBuilder doubt - (Nirmal)Help me sir > > How can I store this lblcompany.text in the Text file (.txt). Help me > sir. > > > > <%@ Import Namespace="System.Data" %> > <%@ Import NameSpace="System.Data.SqlClient" %> > <script language="vb" runat="server"> > Sub Page_Load(sender as Object, e as EventArgs) > Dim i, k As Integer > dim theSQL as string = "SELECT au_id, au_lname, au_fname, phone, address, > " & _ > "city, state, zip, contract FROM Authors" > > Dim myConn as SqlConnection = new > SqlConnection(ConfigurationSettings.AppSettings("DSN_pubs")) > dim ds as dataset = new dataset() > dim dt as datatable > dim adapter as sqldataadapter = new SqlDataAdapter(theSQL, myConn) > > myConn.Open() > adapter.Fill(ds,"DataTable") > myConn.Close() > > dt = ds.Tables("DataTable") > > Dim RowCount As Integer = dt.rows.count > Dim ColCount As Integer = dt.Columns.Count > > Dim sb as StringBuilder = New StringBuilder() > sb.append( "<table border='1' width='80%'>" ) > For i = 0 To RowCount - 1 > sb.Append("<tr>") > For k = 0 To ColCount - 1 > sb.Append("<td>") > sb.Append( dt.Rows(i).Item(k, DataRowVersion.Current).toString()) > sb.Append( "</td>" ) > Next > sb.Append("<tr>") > Next > sb.Append( "</table>") > > Dim strOutput as String = sb.ToString() > lblCompany.Text = strOutput > End Sub > </script> > <html> > <head><title>Using StringBuilder Class</title></head> > <body> > <asp:hyperlink id=returnHome runat="server"> > Back to the Article > </asp:hyperlink> > <asp:label id="lblCompany" runat="server" /> > </body> > </html> > > > > --------------------------------- > Yahoo! India Matrimony: Find your partner now. > > [Non-text portions of this message have been removed] > > > > > > Yahoo! Groups Links > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
