asp.net - output data to text file in asp. markup code -


I have downloaded some sample code which contains a database query within the markup code. This creates a query in the database and displays the results of the web form and I would like to put the output into a text file and I'm not sure how to do this? Can it be done from here or will it be easier to code in the source and to make a new connection to the database?

Sample code:

  & lt; Asp: SqlDataSource id = "SqlDataSource1" runat = "server" connection string = "& lt;% $ connectionString: connection string ip% & gt;" DeleteCommand = "[Remove from country with IP] Where [id] =?" InsertCommand = "[IP-to-Country] ([ID], [BEINGP], [Ending IP], [DocTyriccode], [threeContrycode], [CountryName}) Include values ​​(?,?,?,?,?, ?) "Provider name =" & lt;%% connection: connection: StringIP.ProviderName% & gt; SelectCommand = "SELECT * FROM [ip-to-country] WHERE (([beginingIP] & lift =?) And [[AndingIP] & amp; gt; =?) "Update Command =" update [country from IP] SET [BeginingIP] = ?, [AndingIP] = ?, [DoContrycode] = ?, [three county code] = ?, [Countryname] =? Where [id] =? "& Gt; & Lt; SelectParameters & gt; & Lt; Asp: ControlParameter ControlID = "txtIPNumber" DefaultValue = "" name = "initial" property name = "text" type = "double" /> & Lt; Asp: ControlParameter ControlID = "txtIPNumber" DefaultValue = "" name = "endingip" property name = "text" type = "double" /> & Lt; / SelectParameters & gt; & Lt; DeleteParameters & gt; & Lt; Asp: parameter name = "id" type = "int 32" /> & Lt; / DeleteParameters & gt; & Lt; UpdateParameters & gt; & Lt; ASP: Parameter Name = "BBiIP" Type = "Double" /> & Lt; Asp: parameter name = "endingip" type = "double" /> & Lt; Asp: parameter name = "docantriccode" type = "string" /> & Lt; ASP: Parameter Name = "Three County Code" Type = "String" /> & Lt; Asp: parameter name = "countryname" type = "string" / & gt; & Lt; Asp: parameter name = "id" type = "int 32" /> & Lt; / UpdateParameters & gt; & Lt; InsertParameters & gt; & Lt; Asp: parameter name = "id" type = "int 32" /> & Lt; ASP: Parameter Name = "BBiIP" Type = "Double" /> & Lt; Asp: parameter name = "endingip" type = "double" /> & Lt; Asp: parameter name = "docantriccode" type = "string" /> & Lt; ASP: Parameter Name = "Three County Code" Type = "String" /> & Lt; Asp: parameter name = "countryname" type = "string" / & gt; & Lt; / InsertParameters & gt; & Lt; / ASP: SQLDataSource & gt; & Lt; Br / & gt; IP address: & lt; ASP: Text Box ID = "TCTPedder" Runat = "Server" Wrap = "False" & gt; & Lt; / Asp: text box & gt; & Lt; Br / & gt; IP number: & lt; ASP: Text Box ID = "TTTPNumber" Runat = "Server" AutoPostback = "True" ReadOlline = "True" Rap = "False" & gt; & Lt; / Asp: text box & gt; & Lt; Br / & gt; & Lt; Br / & gt;  

You would better be better at doing this in code, call a database or a dataset Use the same data objects as a source of datagrid or repeater, whatever entities you want to do with the data, or you want to display this data.


Comments