Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 1.0/1.1
Tabelle dinamiche
martedì 05 ottobre 2004 - 16.12
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
mon78
Profilo
| Junior Member
167
messaggi | Data Invio:
mar 5 ott 2004 - 16:12
sto creando una web application in vb.net. In una web form vorrei inserire in codice che mi permette di creare dinamicamente una tabella in excel con i dati che prelevo da un database. Nn so proprio come fare. Mi potete aiutare? grazie mille.
scarface
Profilo
| Newbie
24
messaggi | Data Invio:
mer 6 ott 2004 - 18:40
prova così:
response.buffer = true
Response.Clear
response.ContentType = "application/vnd.ms-excel"
response.AddHeader ("content-disposition", "attachment;filename=pippo.xls")
Dim strConn, strSql As String
strConn= System.Configuration.ConfigurationSettings.appSettings("tuaconn")
strSql = "SELECT * FROM miatabella"
Dim da As SqlDataAdapter = New SqlDataAdapter(strSql, strConn)
Dim ds= New DataSet()
da.Fill(ds, "tabella")
Dim prow As DataRow
Response.Write("<table border=1 bordercolor=lightsteelblue cellspacing=0 align=center>")
Response.Write("<tr><td><strong>Uno</strong></td><td><strong>Due</strong></td><td><strong>Tre</strong></td></tr>")
if ds.Tables("tabella").Rows.Count>0 then
For Each pRow In ds.Tables("tabella").Rows
Response.Write("<tr><td>" & pRow("cod1").ToString() & "</td><td>" & pRow("cod2").ToString() & "</td><td>" & "</td></tr>")
next
end if
Response.Write("</table>")
response.flush
response.end
Ciao
mon78
Profilo
| Junior Member
167
messaggi | Data Invio:
ven 8 ott 2004 - 16:10
grazie tante
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !